Filled area plots in holoviews Overlay?

I’m creating a panel app and using a holoviews Overlay to display a few curves. I could also like to incorporate a filled area graph / filled-between graph. I found the bokeh.models.Band (alias for bokeh.models.annotations.geometry.Band) from the bokeh side. There’s also filled area plots in plotly, namely the go.Scatter with a fill or fillgradient defined.

My previous curves are made with Bokeh using df.hvplot.scatter(), using the import hvplot.pandas monkeypatching API and pandas DataFrames. Seems that they’re holoviews.element.chart.Curve objects in the overlay.items().

How would you create a filled area plot in holoviews and add it to an existing Overlay?

Maybe Spread — HoloViews v1.19.0 or Area — HoloViews v1.19.0

1 Like

Perfect! I was simply searching for “Band” in the holoviews and hvplot source code and as I could not find any matches I thought it might not be supported. I’ll check out which one of them would be more suitable for me :slight_smile: Thanks @Hoxbro !

Small documentation related question. The hv.Area docs say:

For full documentation and the available style and plot options, use hv.help(hv.Area).

I run it in IPython shell and get:

>>> hv.help(hv.Area)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/path/to/venv/lib/python3.12/site-packages/holoviews/__init__.py", line 163, in help
    info = Store.info(obj, ansi=ansi, backend=backend, visualization=visualization,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.12/site-packages/holoviews/core/options.py", line 1257, in info
    info = InfoPrinter.info(obj, ansi=ansi, backend=backend,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.12/site-packages/holoviews/core/pprint.py", line 145, in info
    backend_registry = cls.store.registry.get(backend, {})
                       ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'registry'

Is the help only supported in Jupyter Notebooks?

This is the hv.help(hv.Area) output for future Googlers who are not using Jupyter Notebooks:

Parameters of 'Area'
====================

Parameters changed from their default values are marked in red.
Soft bound values are marked in cyan.
C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None

Name                        Value                     Type     Bounds   Mode 

group                       'Area'                   String             C RW 
label                         ''                     String             C RW 
cdims                         {}                      Dict              V RW 
kdims                  [Dimension('x')]               List     (1, 2)   V RW 
vdims                  [Dimension('y')]               List   (1, None)  V RW 
extents            (None, None, None, None)          Tuple              V RW 
datatype   ['dataframe', 'dictionary', 'grid', '...   List   (0, None)  V RW 

Parameter docstrings:
=====================

group:    A string describing the data wrapped by the object.
label:    Optional label describing the data, typically reflecting where
          or how it was measured. The label should allow a specific
          measurement or dataset to be referenced for a given group.
cdims:    The constant dimensions defined as a dictionary of Dimension:value
          pairs providing additional dimension information about the object.
          
          Aliased with constant_dimensions.
kdims:    The key dimension(s) of a Chart represent the independent
          variable(s).
vdims:    The value dimensions of the Chart, usually corresponding to a
          number of dependent variables.
extents:  Allows overriding the extents of the Element in 2D space defined
          as four-tuple defining the (left, bottom, right and top) edges.
datatype: A priority list of the data types to be used for storage
          on the .data attribute. If the input supplied to the element
          constructor cannot be put into the requested format, the next
          format listed will be used until a suitable format is found (or
          the data fails to be understood).

Hm strange. Could you show your complete code?

In a Jupyter Notebook it works as expected, right?

Hm strange. Could you show your complete code?

Do you mean complete code for checking the help for hv.Area (which is a single command?). The panel app I cannot unfortunately share.

In a Jupyter Notebook it works as expected, right?

That is correct. The help command works as expected in a Jupyter Notebook.

So just the single command works in Jupyter, but not in ipython?

In both cases you still need to import hv first etc., right?

Or did you test by running the command as the last line, after running the whole app?

Could there be a var or object that is still initialized in Jupyter, but not in ipython?

I have fixed this in 1.19.0 (Fix `hv.help` if `Info.store` is `None` by hoxbro · Pull Request #6250 · holoviz/holoviews · GitHub)

1 Like

So just the single command works in Jupyter, but not in ipython?

That’s correct.

Or did you test by running the command as the last line, after running the whole app?

This is unrelated to running the app. Simple

import hv
hv.help(hv.Area)

will reproduce the issue. But seems that it’s already fixed in holoviews 1.19.0. :slight_smile:

1 Like

Awesome!