pg.plot fillLevel= ... horizontal color fill

46 views
Skip to first unread message

Alexey Shulgin

unread,
Oct 11, 2022, 4:16:09 PM10/11/22
to pyqtgraph
Hi, I have a question regarding use of fill color for plot items.
Basically I have an app which plots few linear data graphs in a normal fashion y(x) and I can specify fillvalue=a to use it as a base for color filling.
----
for n in range(len(self.data)):
    self.graph.plot(freq, 
                               self.pos_geophone1 + n * self.geophones_dx
                               - 4.5 * np.sqrt(spec[n])/np.max(np.sqrt(spec[n])),
                               fillLevel=self.pos_geophone1 + n * self.geophones_dx, 
                               brush=(120, 120, 220, 120),
                               pen=pen)
see screenshot below:
2022-10-11 22_01_45-pyqtgraph - Google Группы.png

I want to add an option to display same data but running vertically (kind of rotating entire plot 90 degrees). As pyqtgraph is bad with rotating graphs - the easiest solution is just to flip data columns is pg.plot()
----
for n in range(len(self.data)):
    self.graph.plot(self.pos_geophone1 + n * self.geophones_dx
                               - 4.5 * np.sqrt(spec[n])/np.max(np.sqrt(spec[n])),
                               freq,
                               fillLevel=self.pos_geophone1 + n * self.geophones_dx, 
                               brush=(120, 120, 220, 120),
                               pen=pen)
I'm getting following plot:
2022-10-11 22_11_24-SEG-2_ Data viewer (v. 1.4).png
basically blue infill works incorrectly.

Any advise how this can be fixed - how to specify fillLevel in x domain, instead of standard y-domain?
Thanks in advance

Martin Chase

unread,
Oct 24, 2022, 3:48:53 PM10/24/22
to pyqt...@googlegroups.com
Hey Alexey,

Sorry for the late reply; your message ended up in my spam folder.

Basically, no, pyqtgraph's fill feature has the axis hard-coded, so it is trying to fill vertically despite the intent of your data.

Best,
 - Martin
Reply all
Reply to author
Forward
0 new messages