seaborn
seaborn copied to clipboard
Color scales do not accept name of transform as magic arg
so.Plot(tips, "total_bill", "tip", color="total_bill").add(so.Scatter()).scale(color="sqrt")
Raises:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~/code/seaborn/seaborn/palettes.py in color_palette(palette, n_colors, desat, as_cmap)
205 # Perhaps a named matplotlib colormap?
--> 206 palette = mpl_palette(palette, n_colors, as_cmap=as_cmap)
207 except ValueError:
~/code/seaborn/seaborn/palettes.py in mpl_palette(name, n_colors, as_cmap)
442 else:
--> 443 cmap = mpl.cm.get_cmap(name)
444
~/miniconda3/envs/seaborn-py39-latest/lib/python3.9/site-packages/matplotlib/cm.py in get_cmap(name, lut)
285 return name
--> 286 _api.check_in_list(sorted(_cmap_registry), name=name)
287 if lut is None:
~/miniconda3/envs/seaborn-py39-latest/lib/python3.9/site-packages/matplotlib/_api/__init__.py in check_in_list(_values, _print_supported_values, **kwargs)
128 msg += f"; supported values are {', '.join(map(repr, values))}"
--> 129 raise ValueError(msg)
130
ValueError: 'sqrt' is not a valid value for name; supported values are 'Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'crest', 'crest_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'flare', 'flare_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'turbo', 'turbo_r', 'twilight', 'twilight_r', 'twilight_shifted', 'twilight_shifted_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
~/miniconda3/envs/seaborn-py39-latest/lib/python3.9/site-packages/IPython/core/formatters.py in __call__(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
--> 345 return method()
346 return None
347 else:
~/code/seaborn/seaborn/_core/plot.py in _repr_png_(self)
222 def _repr_png_(self) -> tuple[bytes, dict[str, float]]:
223
--> 224 return self.plot()._repr_png_()
225
226 # TODO _repr_svg_?
~/code/seaborn/seaborn/_core/plot.py in plot(self, pyplot)
625
626 plotter._compute_stats(self, layers)
--> 627 plotter._setup_scales(self, layers)
628
629 # TODO Remove these after updating other methods
~/code/seaborn/seaborn/_core/plot.py in _setup_scales(self, p, layers)
1068 self._scales[var] = Scale._identity()
1069 else:
-> 1070 transform = scale._setup(var_values, prop)
1071 if isinstance(prop, Coordinate):
1072 # If we have a coordinate here, we didn't assign a scale for it
~/code/seaborn/seaborn/_core/scales.py in _setup(self, data, prop, axis)
257 forward,
258 normalize,
--> 259 prop.get_mapping(new, data)
260 ]
261
~/code/seaborn/seaborn/_core/properties.py in get_mapping(self, scale, data)
637 # different from what using the named colormap directly would do
638 # This may or may not be desireable.
--> 639 mapping = color_palette(scale.values, as_cmap=True)
640 elif callable(scale.values):
641 mapping = scale.values
~/code/seaborn/seaborn/palettes.py in color_palette(palette, n_colors, desat, as_cmap)
206 palette = mpl_palette(palette, n_colors, as_cmap=as_cmap)
207 except ValueError:
--> 208 raise ValueError(f"{palette} is not a valid palette name")
209
210 if desat is not None:
ValueError: sqrt is not a valid palette name