HvPlot Pandas - Overlapped boxplots without column distinction

50 Views Asked by At

I am trying to make a simple boxplot using hvplot on a pandas.Dataframe with the plotly extension. What is usually said on different issues is that it should be rather straightforward. HvPlot documentation provides an example that really matches my needs:

import pandas as pd
import hvplot.pandas

hvplot.extension('plotly')    

df = pd.DataFrame(np.random.rand(10, 5), columns=['A', 'B', 'C', 'D', 'E'])
plt = df.hvplot.box()
hvplot.show(plt)

It indeed produces the following figure: good bxplot

However, as soon as I change the column names:

import pandas as pd
import hvplot.pandas

hvplot.extension('plotly')    

df = pd.DataFrame(np.random.rand(10, 5), columns=['Col1', 'Col2', 'Col3', 'Col4', 'Col5'])
plt = df.hvplot.box()
hvplot.show(plt)

Something very strange happens: enter image description here

There is obviously a problem with the interpretation of column names. I think that hvplot only takes the first letter of the column name, then creates the colors but then tries to plot different sets of data that it referenced with the same name, leading to this strange result.

Does anybody know a workaround this problem?

Thank in advance !

0

There are 0 best solutions below