You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HoloViews automatically constructs legends as color keys when plotting categorical data, now even for datashaded plots:
As mentioned in #4806 , in many cases the data itself isn't sufficient to generate such a legend. E.g. in https://examples.pyviz.org/census, the data has a categorical column with 'a' or 'w', but the legend should say 'Asian' or 'White'. Similarly in https://examples.pyviz.org/ship_traffic , the data has a numerical category code, but the legend should say a human-readable value like 'Fishing' or 'Cargo'.
For data like this, it would be useful to be able to supply a legend_labels dictionary option to HoloViews, mapping from a column or dimension value in the data to a human-readable label.
The text was updated successfully, but these errors were encountered:
Does #5342 actually work for all backends? By using the legend_labels option, I get the expected behavior with bokeh, but it appears to have no effect whatsoever with matplotlib.
I test with a figure that has legend labels ('Total', 'Coal', 'Oil', 'Natural gas', 'Oil') to begin with (if I do not use the legend_labels option). The figure is stored in a variable called raw_fig. I test with the following code:
With bokeh extension, the legend labels change to a, b, c, d, e as expected. With matplotlib extension and everything else identically the same, they do not. I can also switch back and forth between the two extensions. When bokeh is active, the changed labels are displayed. When matplotlib is active, the original labels are displayed.
I am using the Jupyter Notebook extension in Visual Studio code. with holoviews version 1.15.4 and matplotlib version 3.6.3, running on WSL Ubuntu 20.04 LTS under Windows 11.
HoloViews automatically constructs legends as color keys when plotting categorical data, now even for datashaded plots:
As mentioned in #4806 , in many cases the data itself isn't sufficient to generate such a legend. E.g. in https://examples.pyviz.org/census, the data has a categorical column with 'a' or 'w', but the legend should say 'Asian' or 'White'. Similarly in https://examples.pyviz.org/ship_traffic , the data has a numerical
category
code, but the legend should say a human-readable value like 'Fishing' or 'Cargo'.For data like this, it would be useful to be able to supply a
legend_labels
dictionary option to HoloViews, mapping from a column or dimension value in the data to a human-readable label.The text was updated successfully, but these errors were encountered: