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
When attempting to build an overlay of polygons from a dataset using a groupby, coloring
the polygons by some category, and showing the legend, I am met with:
ValueError: Only one of legend, legend_label, legend_field or legend_group may be provided, got: legend_label or legend_field
I would expect to see an overlay of polygons, colored by their category, with the legend showing the category colors. If I remove the categorical coloring, or the legend, the polygons are overlayed correctly (but I would be missing either the coloring or the legend).
If I pad my data to "close" the polygons and use hv.Path instead, the correct plot and coloring is done and a legend is provided, but the legend is incorrect (missing + incorrect entries).
If I manually construct the overlay using a loop to produce the individual hv.Polygon elements while also using a colormap, the correct overlay is produced, but the legend is incorrect (missing + incorrect entries).
If I manually construct the overlay using a loop to produce the individual hv.Path elements, then everything works (but this is way clunkier).
Complete, minimal, self-contained example code that reproduces the issue
Traceback (most recent call last):
File "/root/micromamba/envs/starling/lib/python3.11/site-packages/holoviews/plotting/bokeh/element.py", line 2047, in _init_glyphs
renderer, glyph = self._init_glyph(plot, mapping, properties)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/micromamba/envs/starling/lib/python3.11/site-packages/holoviews/plotting/bokeh/path.py", line 294, in _init_glyph
renderer = getattr(plot, plot_method)(**data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/micromamba/envs/starling/lib/python3.11/site-packages/bokeh/plotting/_decorators.py", line 87, in wrapped
return create_renderer(glyphclass, self.plot, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/micromamba/envs/starling/lib/python3.11/site-packages/bokeh/plotting/_renderer.py", line 81, in create_renderer
legend_kwarg = pop_legend_kwarg(kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/micromamba/envs/starling/lib/python3.11/site-packages/bokeh/plotting/_legends.py", line 50, in pop_legend_kwarg
raise ValueError(f"Only one of {nice_join(LEGEND_ARGS)} may be provided, got: {nice_join(result.keys())}")
ValueError: Only one of legend, legend_label, legend_field or legend_group may be provided, got: legend_label or legend_field
Screenshots or screencasts of the bug in action
Errors and Attempted Workarounds
Error
hv.Path with Incorrect Legend
Manual Overlay of hv.Polygon with incorrect legend
Manual (and Correct!) Overlay with hv.Path
Note that I am manually setting labels and colors; trying to use a column to set values results in issues.
I may be interested in making a pull request to address this
The text was updated successfully, but these errors were encountered:
ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)
Software Version Info
Description of expected behavior and the observed behavior
Opening this in response to https://discourse.holoviz.org/t/dataset-to-polygons-with-groupby-legend/8183. It is not clear to me if this is all one bug, or a collection of bugs due to this happening in different ways with different setups.
When attempting to build an overlay of polygons from a dataset using a groupby, coloring
the polygons by some category, and showing the legend, I am met with:
I would expect to see an overlay of polygons, colored by their category, with the legend showing the category colors. If I remove the categorical coloring, or the legend, the polygons are overlayed correctly (but I would be missing either the coloring or the legend).
If I pad my data to "close" the polygons and use
hv.Path
instead, the correct plot and coloring is done and a legend is provided, but the legend is incorrect (missing + incorrect entries).If I manually construct the overlay using a loop to produce the individual
hv.Polygon
elements while also using a colormap, the correct overlay is produced, but the legend is incorrect (missing + incorrect entries).If I manually construct the overlay using a loop to produce the individual
hv.Path
elements, then everything works (but this is way clunkier).Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output
Screenshots or screencasts of the bug in action
Errors and Attempted Workarounds
Error
hv.Path
with Incorrect LegendManual Overlay of
hv.Polygon
with incorrect legendManual (and Correct!) Overlay with
hv.Path
Note that I am manually setting labels and colors; trying to use a column to set values results in issues.
The text was updated successfully, but these errors were encountered: