Set default plot size for all plot types?

I find the default plot sizes to be very small and too “square”. I know you can set the default plot size for each plot type individually, but there are just so many plot types. Therefore: Is there a way to set the default plot size for all plot types at once?

It would be nice if this here worked, but it doesn’t:

opts.defaults(width=500, height=350)

Here is what I have been using. It’s very ugly and hacky and works by basically trying to set the parameter values on all valid members of hv.opts. I’m sure there must be a much better and cleaner way to do this though!

def hv_universal_defaults(defaults: dict):
    for k in filter(
        lambda k: inspect.ismethod(getattr(hv.opts, k))
        and k
        not in ("_add_parameter", "print_param_defaults", "set_default", "defaults"),
        dir(hv.opts),
    ):
        try:
            hv.opts.defaults(getattr(hv.opts, k)(**defaults))
        except (ValueError, TypeError, AttributeError):
            pass

It can be used with e.g.

hv_universal_defaults(dict(frame_width=600))

Does something like this work?

hv.plotting.bokeh.ElementPlot.width = 1000
hv.plotting.bokeh.ElementPlot.height = 1000
2 Likes

Is this documented somewhere? A lot of times, I just define some

DEFAULT_KWDS = {“width”: “…”, etc}

Wow. That indeed worked! Thanks!

Oh man. There are all the settings, lol. I have searched forever how to set the level of detail threshold where it starts subsampling when you move around in the plot. Stuff like this should be in the documentation. I was not able to find it anywhere. Used Google and everything.

hv.plotting.bokeh.ElementPlot.lod['threshold'] = 20_000
3 Likes

I agree! Can you submit an issue to HoloViews?

2 Likes