holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.7k stars 403 forks source link

Loading bokeh backend breaks output in matplotlib backend #3776

Closed poplarShift closed 5 years ago

poplarShift commented 5 years ago

Below, when bokeh is loaded first, it breaks matplotlib output even though I select hv.output(..., backend='matplotlib').

import warnings
import xarray as xr
import numpy as np
import holoviews as hv
# import geoviews as gv
hv.extension('matplotlib') # works
# hv.extension('bokeh', 'matplotlib') # does not

da = xr.DataArray(np.random.rand(10,8), dims=['lon', 'lat']).rename('air')
im = hv.QuadMesh(da, ['lon', 'lat'], ['air']).opts(colorbar=True, cmap='cividis', clone=True)
with warnings.catch_warnings():
    # ignore some recent matplotlib deprecation warnings
    warnings.simplefilter('ignore')
    hv.output(im, backend='matplotlib')

What 'breaks' is that colorbar and cmap options are completely disregarded.

I have not found a workaround. After a hv.extension('bokeh', 'matplotlib') at any point, holoviews seems bent on not letting me have my colorbar.

poplarShift commented 5 years ago

The issue was specifying the backend in the options call: hv.QuadMesh(da, ['lon', 'lat'], ['air']).opts(colorbar=True, cmap='cividis', backend='matplotlib').

This is relatively confusing, because when I specify an Options object it does not seem to register the currently active backend either: hv.Options('Image', cmap='fire') just returns Options('Image', cmap='fire') with no mention of the backend, yet those options will be respected in the respective backend.

github-actions[bot] commented 1 week ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.