plotly / plotly_express

Plotly Express - Simple syntax for complex charts. Now integrated into plotly.py!
https://plot.ly/python/plotly-express/
MIT License
4 stars 0 forks source link

Fill between two vertical lines but multiple times #176

Open PaulForInvent opened 3 years ago

PaulForInvent commented 3 years ago

Hey, I wonder how I can do that.

I tried it the follwoing way, but it also need very much time if you have a lot of add_vrectto add...

I calculated beforehand the needed start and end positions for each single add_vrect.

But this somehow seems not working as all of the chart is filled...

Maybe is it he time format? My Time format is like: 2021-07-15T01:00:00.000000000.

How can I do this more simpler of without a for loop to be more efficient?

   for index, row in enumerate(first):
        start = row
        end = last[index]

        fig.add_vrect(x0=start, x1=end,
                      annotation_text="decline", annotation_position="top left",
                      fillcolor="green", opacity=0.25, line_width=1)