-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot have more than one legend in panel card #35
Comments
@aulemahal Have you ever had this happen before? Here's the code block, if I try to set legend_show = True, then all the plots after the distribution comparison disappear dist_diff = (
hv.Distribution(simi.values, label={"en":"Target's future","fr":"Ville ciblée dans le futur"}[language]).opts(color=fut_col)
* hv.Distribution(refi.values, label={"en":"Analogue's present","fr":"Analogue dans le présent"}[language]).opts(color=ana_col)
* hv.Distribution(histi.values, label={"en":"Target's present","fr":"Ville ciblée dans le présent"}[language]).opts(hooks=[distr_hook],color='white', line_color='black')
).opts(
ylabel={"en":'Probability Density',"fr":"Densité de probabilité"}[language], xlabel=name,
legend_cols=True, legend_offset=(0, 0), legend_position='bottom', fontscale=0.8,
title={"en":'Distribution comparison',"fr":"Comparaison des distributions"}[language], xlim=xlim,
toolbar = 'above', height=300, width=None
)
mean_change = (
hv.Overlay(
[hv.VLine(histi.quantile([q]).item()).opts(color='darkgrey', line_dash='dashed', alpha=0.8)
for q in [0.1,0.25,0.5,0.75,0.9]]
) * hv.Points([[refi.mean().item(), 1]], label="Analogue").opts(color=ana_col, size=20, marker='circle')
* hv.Points([[histi.mean().item(), 1]], label={"en":"Target's present","fr":"Ville ciblée dans le présent"}[language]).opts(color=hist_col, size=20, marker='star', line_color='k')
* hv.Points([[simi.mean().item(), 1]], label={"en":"Target's future","fr":"Ville ciblée dans le futur"}[language]).opts(color=fut_col, size=20, marker='star')
).opts(
yaxis=None, xlim=xlim, height=100, xlabel=name,
show_legend=False, # legend_position='bottom', legend_offset=(0, 0), legend_cols=True,
fontscale=0.8, title={"en":'Average change',"fr":"Changement moyen"}[language], ylabel='nothing', toolbar='above'
)
if int(tgt_period.start) >= 2020:
refcp = refi.assign_coords(time=simi.time).hvplot(color=ana_col).opts(tools=[], show_legend=False)
else:
refcp = hv.Overlay()
plot_range = hv.Area((simq.time,simq.sel(quantile=0.1),simq.sel(quantile=0.9)),vdims=['y','y2']).opts(tools=[],show_legend=False, color='darkgrey',alpha=0.5,line_width=0)
plot_median= simq.sel(quantile=0.5).hvplot(color='darkgrey').opts(tools=[],show_legend=False)
#p3 = histi.mean('realization').hvplot().opts(line_color='yellow')
timeseries = (
(hv.VLine(simi.indexes['time'][0]) * hv.VLine(simi.indexes['time'][-1])).opts(hv.opts.VLine(color='lightblue', line_width=2))
* plot_range
* plot_median
* refi.hvplot(color=ana_col, label={"en":'Selected analogue',"fr":"Analogue choisi"}[language])
* refcp
* simt.hvplot(color=fut_col, label={"en":'Selected simulation on target city',"fr":"Simulation choisi dans la ville ciblée"}[language])
).opts(
ylabel=units, xlabel='', title={"en":'Full timeseries',"fr":"Série temporelle complète"}[language], legend_position='top',
show_legend=False, toolbar='above',height=300
)
description = pn.pane.Markdown(
{"en":f"### Quality of univariate analogy: {uni_score: 5.2f} ({quality_terms_en[qflag]})\n"
f'- **Description**: {simi.description}\n'
f'- **Units** : {simi.units}\n\n',
"fr":f"### Qualité de l'analogie univarié: {uni_score: 5.2f} ({quality_terms_fr[qflag]})\n"
f'- **Description**: {simi.description_fr}\n'
f'- **Unités** : {simi.units}\n\n'
}[language],
max_width=920,sizing_mode='stretch_width',width_policy='max'
)
panelcard.clear()
panelcard.insert(0,description)
panelcard.insert(1,pn.pane.HoloViews(dist_diff, linked_axes=False,max_width=920,sizing_mode='stretch_width',width_policy='max'))
panelcard.insert(2,pn.pane.HoloViews(mean_change, linked_axes=False,max_width=920,sizing_mode='stretch_width',width_policy='max'))
panelcard.insert(3,pn.pane.HoloViews(timeseries, linked_axes=False,max_width=920,sizing_mode='stretch_width',width_policy='max')) |
Oh boboy... I have no idea, sorry! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tried to implement legends for the timeseries and mean comparison, with no success... Really weird bug.
The text was updated successfully, but these errors were encountered: