Update axis label of plot on event

Hi,

sorry if this is a trivial question. I’m trying to add multilanguage support to the glaciers app - I have no issues to update text, etc. on event, but I don’t know how to update plot elements such as an axis label.

Plots in the app are an overlay of a static plot and a DynamicMap, both with the same labels at the start of the app. Is there an “update” method or similar which would allow me to rename y and x labels on a button event?

Thanks!

Fabien

OK, we have made some progress by setting the plot labels dynamically each time the selection is updated and by triggering an update when the language is changed. You can see the code here and the app served here.

However, with the current design we still struggle with the datashader plots, because they ignore the options from the holoview plot they are embedding.

So my original question remains: is there a way to change the bokeh plot labels on event? I’m thankful for any advice :wink:

OK, more search to the win: the solution is to use hooks:

def elev_language(plot, element):
    plot.handles['xaxis'].axis_label = {'en':'Mean elevation of the glacier (m a.s.l.)',
                                        'de':'Mittlere Höhe des Gletschers (m ü.M.)'}[language]
    plot.handles['yaxis'].axis_label = {'en':'Latitude (deg)',
                                        'de':'geographische Breite (deg)'}[language]

(...)

elevation.options(hooks=[elev_language])