Reputation: 93
I have a pandas dataframe, data
from which I would like to create a datashader plot with a histogram next to it. I get the datashader plot to work but when I try to add the histogram it is not working anymore. What I am doing is the following:
column | |
---|---|
2022-04-30 22:00:00+00:00 | 101.4 |
2022-04-30 22:03:00+00:00 | 259.5 |
scatter_dict, hist_dict = hv_elements(data, flag="app", colors=colors, num_bins=500, y_range=y_range,
kind=kind)
curve_overlay = hv.NdOverlay(scatter_dict, kdims='cols')
ds_curve_overlay = dynspread(datashade(curve_overlay,
aggregator=ds.count_cat('cols'),
y_range=y_range,
color_key=colors)).opts(
height=height,
title=title,
xlabel=xlabel,
ylabel=ylabel,
xrotation=xrotation,
active_tools=active_tools,
hooks=[hv_dateformatter],
responsive=responsive,
**kwargs)
Which is working fine.
lnk_sel = link_selections.instance()
h = hv.NdOverlay(hist_dict)
h.opts(width=hist_width,
height=height,
xrotation=xrotation,
xlabel='',
ylabel=ylabel,
)
dmap = (ds_curve_overlay).opts(height=height)
linked_dmap = lnk_sel(dmap + h)
return linked_dmap
However, every time I try to add the histogram it doesn't work... Does anybody see why I am having this problem?
Thank you in advance,
Upvotes: 0
Views: 70
Reputation: 93
I managed to solve the problem I had by doing a panel with both plots:
panel = pn.Row(linked_dmap, h)
return panel.servable()
Upvotes: 0