[Using holoviews version 1.14.1, bokeh version 2.2.3]
I am trying to generate a boxwhisker plot with two categorical variables in the x-axis, and then overlay the scatter plot (with the same data) over it. The idea is to compare two strata/groups over a set of features and visualize the distributional differences with box+scatter plot. I am struggling to get the dimensions aligned, any hints/tips/direction/advice would be much appreciated.
def changeOrderAndFont(plot,element):
factors = itertools.product(['F5','F4','F3','F2','F1'],['GroupA','GroupB'])
plot.state.x_range.factors = [*factors]
plot.handles['xaxis'].major_label_text_font_size = '12pt'
plot.handles['xaxis'].major_label_orientation = pi/2
plot.handles['xaxis'].group_text_font_size = '10pt'
plot.handles['yaxis'].axis_label_text_font_size = '10pt'
plot.handles['yaxis'].axis_label_text_font_style = 'normal'
plot.handles['xaxis'].axis_label_text_font_style = 'normal'
values = np.random.normal(0,1,size=50)
strata = np.random.choice(['GroupA','GroupB'],size=50)
feature = np.random.choice(['F1','F2','F3','F4','F5'],size=50)
df = pd.DataFrame({'Strata':strata,'Feature':feature,'Values':values})
pp = hv.BoxWhisker(df,kdims=['Feature','Strata'],vdims=['Values']).opts(cmap='Category20',box_color='Strata',height=400,width=400,hooks=[changeOrderAndFont])
# ss = hv.Scatter(df,kdims=['Feature','Strata'],vdims=['Values','Strata']) #gives a warning about a single kdim, and an error on dimension alignment
# ss = hv.Scatter(df,kdims=['Feature'],vdims=['Values','Strata']) #gives an error on dimension alignment
# (pp*ss) # errors here
pp
example boxplot:
Thanks!