FillBetweenItem similar class?

19 views
Skip to first unread message

kun...@me.com

unread,
Aug 5, 2016, 2:56:02 AM8/5/16
to pyqtgraph

Please see the attachment. I want to create a plot like the RSI indicator on the top of the picture.

How can i fill some of the data with colors. say, when y > 70 or y < 30 , fill them with read brush.


I have tried fillbetween, the result doesn't fit my need, what can i do?  


Do i have to calculate each join point and caculate each individual region to fill?


is there any easy solution? 




aapl.png

Walter

unread,
Aug 19, 2016, 12:57:23 PM8/19/16
to pyqtgraph
Why doesn't fill between work for you?

What I do is create several PlotDataItems. I set PlotDataItem2 to be the same as PlotDataItem1 when y < 70. When y > 70, I set the y values PlotDataItem2 to be equal to 70. The result is that the FillBetweenItem only appears to color in the area between the curves when y > 70.

You can then do the same thing with a FillBetweenItem for PlotDataItem3 and PlotDataItem1 when y < 30. 
Reply all
Reply to author
Forward
0 new messages