How can i shade an area between two vertical lines?
TraderMan999 opened this issue · comments
For example, i produce an image that presents each day (one separate image for each day).
On each image i mark a vertical line between 830am est and 1100am est. All that is easily done.
Then i want to shade the area between those two lines. I used the examples provided (https://github.com/matplotlib/mplfinance/blob/master/examples/using_lines.ipynb)
Here's a code snippet:
vls = ['2023-06-02 08:30', '2023-06-02 11:00']
mpf.plot(data, type='candle', vlines = dict(vlines=vls, linewidths=120, alpha=.4))
I shade wtih alpha = .4
The shading is not drawing in the right spot (between 830am and 11am)
Questions:
- is "linewidths" even relavant or required in my scenario? i played with all kinds of different numbers there but didnt get what i wanted
- what should i be doing differently to shade only the area between the vertical lines at 830am and 11am?
Here's an example of what im seeing based on the code above:
As we can see in the image link above, the alpha shading is not between only 830am and 11am
use fill_between in dict
mode, specifying y1
and y2
for the vertical boundaries, and use where
for the horizontal boundaries (specified as a series of boolean (true/false) values, where the series is the same length as your dataframe). Click here for tutorial.