Search code examples
pythonholoviews

Retrieve options already applied to a holoviews object


When I apply options to a holoviews object (Element, Layout, Holomap, ...), is it possible to retrieve those options later on?

p=hv.Points(np.random.rand(100,2)).options(width=700, size=10, color='r')

Given p, (how) can I find width=700, size=10, color='r'?

I've gone through all the attributes of p and also looked through StoreOptions but to no avail.


Solution

  • Just to elaborate on the internal API, you can use the following to get an ordered dictionary of the options set:

    from holoviews import Store
    options = Store.lookup_options(Store.current_backend, p, 'style')
    options.kwargs
    

    where options is an Options object containing just the 'style' options of object p (the distinction between 'style' and 'plot' options are described at the end of the user guide).