Skip to content

Commit b79d322

Browse files
authored
fix color being parsed for none (#312)
1 parent ff91841 commit b79d322

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ultraplot/axes/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2509,7 +2509,7 @@ def _parse_color(self, x, y, c, *, apply_cycle=True, infer_rgb=False, **kwargs):
25092509
# functions and helper functions.
25102510
parsers = (self._parse_cmap, *self._level_parsers)
25112511
if c is None or mcolors.is_color_like(c):
2512-
if infer_rgb and c is not None:
2512+
if infer_rgb and c is not None and c != "none":
25132513
c = pcolors.to_hex(c) # avoid scatter() ambiguous color warning
25142514
if apply_cycle: # False for scatter() so we can wait to get correct 'N'
25152515
kwargs = self._parse_cycle(**kwargs)

ultraplot/tests/test_plot.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,16 @@ def test_pie_labeled_series_in_dataframes():
420420
for text, index in zip(texts, data.index):
421421
assert text.get_text() == index
422422
uplt.close(fig)
423+
424+
425+
def test_color_parsing_for_none():
426+
"""
427+
Ensure that none is not parsed to white
428+
"""
429+
fig, ax = uplt.subplots()
430+
ax.scatter(0.4, 0.5, 100, fc="none", ec="k", alpha=0.2)
431+
ax.scatter(0.5, 0.5, 100, fc="none", ec="k")
432+
ax.scatter(0.6, 0.5, 100, fc="none", ec="k", alpha=1)
433+
for artist in ax[0].collections:
434+
assert artist.get_facecolor().shape[0] == 0
435+
uplt.close(fig)

0 commit comments

Comments
 (0)