From b737b8222d20566757d4494b1f1b362d4684d7be Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 3 Aug 2025 17:06:39 +0200 Subject: [PATCH 1/2] fix color being parsed for none --- ultraplot/axes/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ultraplot/axes/plot.py b/ultraplot/axes/plot.py index ac81fcfea..bec31758e 100644 --- a/ultraplot/axes/plot.py +++ b/ultraplot/axes/plot.py @@ -2509,7 +2509,7 @@ def _parse_color(self, x, y, c, *, apply_cycle=True, infer_rgb=False, **kwargs): # functions and helper functions. parsers = (self._parse_cmap, *self._level_parsers) if c is None or mcolors.is_color_like(c): - if infer_rgb and c is not None: + if infer_rgb and c is not None and c != "none": c = pcolors.to_hex(c) # avoid scatter() ambiguous color warning if apply_cycle: # False for scatter() so we can wait to get correct 'N' kwargs = self._parse_cycle(**kwargs) From cd1339945439ea1b4e24c7e7063dd3f1e4f73911 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 3 Aug 2025 17:15:35 +0200 Subject: [PATCH 2/2] added unittest --- ultraplot/tests/test_plot.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ultraplot/tests/test_plot.py b/ultraplot/tests/test_plot.py index 98a7d2495..6f09e1834 100644 --- a/ultraplot/tests/test_plot.py +++ b/ultraplot/tests/test_plot.py @@ -420,3 +420,16 @@ def test_pie_labeled_series_in_dataframes(): for text, index in zip(texts, data.index): assert text.get_text() == index uplt.close(fig) + + +def test_color_parsing_for_none(): + """ + Ensure that none is not parsed to white + """ + fig, ax = uplt.subplots() + ax.scatter(0.4, 0.5, 100, fc="none", ec="k", alpha=0.2) + ax.scatter(0.5, 0.5, 100, fc="none", ec="k") + ax.scatter(0.6, 0.5, 100, fc="none", ec="k", alpha=1) + for artist in ax[0].collections: + assert artist.get_facecolor().shape[0] == 0 + uplt.close(fig)