import xarray as xr
import hvplot.xarray
ds = xr.tutorial.open_dataset('air_temperature').mean(['lat', 'lon'])
ds['airx2'] = ds['air'] * 2
ds = ds.to_array().rename('test')
ds.hvplot('time', by='variable')
Is there a way to remove legend title variable
?
In holoviews, this gives you what you want.
h = ds.hvplot('time', by='variable')
h.get_dimension('variable').label=''
There is a h.redim.label
function also but I don’t manage to make it work.
Besides, there is always the possibility to finely tune what you want on the bokeh side of things.
import holoviews as hv
from bokeh.io import show
h = ds.hvplot('time', by='variable')
fig = hv.renderer('bokeh').get_plot(h).state
fig.legend.to_json(include_defaults=False)
This last line indicates what can be changed about the legend:
{'click_policy': 'mute',
'id': '2395',
'items': [{'id': '2396'}, {'id': '2427'}],
'location': [0, 0],
'title': 'variable'}
These next lines yield the desired result:
fig.legend.title = ''
show(fig)
1 Like