Y Axis Padding & Categorical Data
Hvplot padding cannot handle categorical data as per discourse topic.
The discourse suggested ylim solution does work in the MRE, however in my own plots the y axis lims are not perfect (i.e. the top gap is greater than the bottom) so creating this issue to track the padding issue.
This issue has been mentioned on HoloViz Discourse. There might be relevant details there:
https://discourse.holoviz.org/t/y-axis-padding/8984/3
@killcoder, could you provide an MRE of the padding issue
@droumis thanks for following up. I tried to recreate a MRE from the original example which highlights the issue, but the top and bottom gaps work just fine in this example.
import holoviews as hv
import numpy as np
import pandas as pd
import hvplot.pandas # noqa
import panel as pn
df = pd.DataFrame(
np.random.randint(0, 2, size=(100, 10)), columns=list("ABCDEFGHIJ")
)
df1 = pd.DataFrame(np.random.randint(0,2,size=(100, 5)), columns=list('ABCDE'))
for col in df.columns:
df[col] = np.where(df[col] == 1, col, "")
for col in df1.columns:
df1[col] = np.where(df1[col] == 1, col, "")
plot = df.hvplot.scatter(
framewise=True,
shared_axes=True,
subcoordinate_y={"subcoordinate_scale": 0.01},
title="DiscretesIn",
ylim=(-0.5, len(df.columns) - 0.5),
# padding=(0.1, 0.75),
responsive=True,
legend=False,
)
plot1 = df1.hvplot.scatter(
framewise=True,
shared_axes=True,
subcoordinate_y={"subcoordinate_scale": 0.01},
title="DiscretesOut",
ylim=(-0.5, len(df.columns) - 0.5),
# padding=(0.1, 0.75),
responsive=True,
legend=False,
)
pn.Row(hv.Layout(plot + plot1).opts(shared_axes=False)).show()
My original attempt was to use padding and this makes no difference to the final plot. Maybe my understanding of padding is wrong
YLIM
Padding
I've got use to the gap in my plots at work so this issue can probably be closed unless padding should actually work similar to y-lim.