hvplot
hvplot copied to clipboard
Odd behaviour in order of hvplot bars given number of columns.
When dataframe length is > 10 the order of bars are reversed.
ALL software version info
bokeh==3.3.1 holoviews==1.18.0 hvplot==0.9.1 jupyterlab==4.0.10 pandas==2.1.3
Python 3.10.12
Description of expected behavior and the observed behavior
import pandas as pd
import hvplot.pandas
# Create dataframe of length 1-10 and the ordering is fine
df = pd.DataFrame({col: range(20) for col in range(10)})
# Nice ordering.
chart_1 = df.count().to_frame().T.hvplot.bar(rot=90, width=1400, height=500)
chart_1
# Create dataframe of lenght > 10 and the ordering is now reversed
df = pd.DataFrame({col: range(20) for col in range(11)})
# Reverse ordering.
chart_2 = df.count().to_frame().T.hvplot.bar(rot=90, width=1400, height=500)
chart_2
It get's even weirder. Reversing the order of the data columns has a different effect when there are less or more than 10 columns. In the first case, it reverses the color mapping, but does not reverse the index. In the second case it reverses the color mapping and the index.
It could be some ordering problem when converting int to str.
This seems to work as expected df = pd.DataFrame({f"{col:02d}": range(20) for col in range(11)})