0

The vrect example at [Time Series Regions with Rectangle Shapes] [1]: https://plotly.com/python/shapes/#rectangles-positioned-relative-to-the-axis-data does not work with subplots.

e.g. If the fig (Figure object) is constructed as go.Fugure() the code works. But fig object returned by make_subplots() doesn't.

    #fig = go.Figure()
    fig = make_subplots(rows=2, cols=1,
                        column_widths=[1],
                        row_heights=[0.15, 0.85],
                        specs=[[{'type': 'xy'}], [{'type': 'table'}]],
                        vertical_spacing=0.08
                        )

----
----
----
    # Add shape regions
    fig.add_vrect(
        x0="2015-02-04", x1="2015-02-13",
        fillcolor="LightSalmon", opacity=0.5,
        layer="below", line_width=0,
    ),
    fig.show()
ValueError: Cannot add shape to subplot at position (2, 1) because subplot is of type domain.

This limits highlight features only to standalone plots vs mixed subplots (plotly.subplots)

Anyone else facing this issue?

pa3m
  • 1
  • 2

0 Answers0