Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with hvplot plotly violin plots using 'by' argument #6236

Closed
sam-spence opened this issue May 17, 2024 · 0 comments · Fixed by #6237
Closed

Bug with hvplot plotly violin plots using 'by' argument #6236

sam-spence opened this issue May 17, 2024 · 0 comments · Fixed by #6237

Comments

@sam-spence
Copy link

Violin plots on hvplot with the plotly extension do not work properly when using the 'by' argument to make a violin for each category. Instead of one violin per category as expected, only the first letter of each category is used, and violins of categories with the same first letter are stacked. The legend shows only the first letter of each category name instead of the full names.

This can also be seen in the hvplot documentation. For example the violin plot at the bottom of this page, using bokeh, in which each category has its own violin and its full name shown on the x axis and on the legend. This is the expected behaviour.

Compare with the same plot using the plotly extension, you can see that any categories that share the same first letter are stacked e.g. OO and OH are stacked and are both labelled as O.

Software versions, although I think it doesn't matter since the bug is visible in the documentation as well:
Python 3.12 running on mac os 13.3.1 and on a Linux server
Holoviews 1.18.3

Reproducible code:

import numpy as np
import hvplot.pandas
import hvplot.dask

hvplot.extension('plotly')
from hvplot.sample_data import us_crime, airline_flights
flights = airline_flights.to_dask().persist()
bugged_plot = flights.hvplot.violin(y='depdelay', by='carrier', ylim=(-20, 60), height=500)
hvplot.show(bugged_plot)

hvplot.extension('bokeh')
correct_plot = flights.hvplot.violin(y='depdelay', by='carrier', ylim=(-20, 60), height=500)
hvplot.show(correct_plot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant