holoviz / hvplot

A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews
https://hvplot.holoviz.org
BSD 3-Clause "New" or "Revised" License
1.13k stars 108 forks source link

Scatter matrix grid alignment with rotated X labels #654

Open chuard opened 3 years ago

chuard commented 3 years ago

When I rotate my X labels in a scatter matrix, the lower left panel does not seem to align correctly.

samples = 40
hvplot.scatter_matrix(pd.DataFrame({
    'a':np.random.normal(0.5, 1, size=samples),
    'b':np.random.normal(0.0,2.0, size=samples),
    'c':np.random.normal(1e10,0.5e10,size=samples)}), xrotation=90)

hvplot = 0.7.3 holoviews = 1.14.5 bokeh = 2.3.3

jbednar commented 3 years ago

Thanks! I suspect this would be a Bokeh issue, though.

chuard commented 3 years ago

Thanks! Yes, it does seem like the Bokeh layout is doing something that doesn't make sense. I am trying replicate the issue with bare Bokeh so I can bring it up with them, but I'm having trouble replicating it. It seems like the only unique aspect of my case is the xrotation=90, and if I replicate that in a simple Bokeh gridplot it seems to work fine. Any help or advice would be appreciated.

Code, derived from Bokeh gridplot example:

from bokeh.io import output_notebook, show
from bokeh.layouts import gridplot
from bokeh.plotting import figure

output_notebook()

x = list(range(11))
y0 = x
y1 = [10 - i for i in x]
y2 = [abs(i - 5) for i in x]

# create three plots
s1 = figure(background_fill_color="#fafafa")
s1.circle(x, y0, size=12, alpha=0.8, color="#53777a")

s2 = figure(background_fill_color="#fafafa")
s2.triangle(x, y1, size=12, alpha=0.8, color="#c02942")

s3 = figure(background_fill_color="#fafafa")
s3.square([i*10000 for i in x], y2, size=12, alpha=0.8, color="#d95b43")
s3.xaxis.major_label_orientation = 'vertical'
s3.xaxis.axis_label = 'Column 2'

s4 = figure(background_fill_color="#fafafa")
s4.square(x, y2, size=12, alpha=0.8, color="#d95b43")
s4.xaxis.major_label_orientation = 'vertical'
s4.xaxis.axis_label = 'Column 1'

# make a grid
grid = gridplot([[s1, s2], [s4, s3]], width=250, height=250)

show(grid)
shoukewei commented 1 year ago

But it seems that it cannot rotate the Count one. Is there any method to rotate it too? Thanks

image