I would like to set default options for the plots generated by hvplots.
Normally in holoviews I would do this to set defaults for every plot:
import holoviews as hv
from holoviews import opts
hv.extension('bokeh')
opts.defaults(opts.Curve( height=400, width=900 ,show_grid=True))
Now that I'm using hvplots the import has become the following for xarray based plotting
import xarray as xr
import hvplot.xarray
If I have an xarray dataset and I want to plot one of the dimensions then I use this
ds.myDims.hvplot()
However this gives a plot with a default width and no grid lines. To add this I need to specify the options with the plot.
ds.myDims.hvplot(height=400, width=900,grid=True)
Ideally I'd like to set the height, width, grid etc globally, like I can in holoviews, so I don't have to specify it for every plot.
EDIT:
With hvplot >= 0.5 you can now set default settings for your plots as follows:
from holoviews import opts
opts.defaults(
opts.Scatter(
width=700, height=300,
color='black',
active_tools=['box_zoom'],
))
Alternative (older) solution:
Define your default settings in a dictionary and unpack that dictionary everytime you create plot:
default_settings = {'height': 400, 'width': 900}
plot = ds.myDims.hvplot(**default_settings)
another_plot = ds.myDims.hvplot(**default_settings)