holoviz-topics / EarthSim

Tools for working with and visualizing environmental simulations.
https://earthsim.holoviz.org
BSD 3-Clause "New" or "Revised" License
65 stars 21 forks source link

Plot options syntax #278

Closed kcpevey closed 5 years ago

kcpevey commented 5 years ago

grabcut.py has the following snippet of plot options:

options = Store.options('bokeh') options.Points = Options('plot', padding=0.1) options.Path = Options('plot', padding=0.1) options.Polygons = Options('plot', padding=0.1)

These are a little different syntax than what's shown in the hv docs. Would this syntax still be recommended?

I'd prefer to use it since the hv doc approach leaves me loading bokeh twice (once in the py file, once in the notebook), but I don't want to use a deprecated syntax.

philippjfr commented 5 years ago

These are a little different syntax than what's shown in the hv docs. Would this syntax still be recommended?

This will continue to be supported but I would not recommend it.

I'd prefer to use it since the hv doc approach leaves me loading bokeh twice (once in the py file, once in the notebook), but I don't want to use a deprecated syntax.

Rather than loading the extension twice I'd probably just set the backend directly, e.g. the code above could be replaced with:

hv.Store.set_current_backend('bokeh')
opts.defaults(
    opts.Points(padding=0.1),
    opts.Path(padding=0.1),
    opts.Polygons(padding=0.1))
kcpevey commented 5 years ago

Perfect. That's what I was looking for. Thanks!