Another possible approach - I’m not saying it’s a good one necessarily, just 
possible - is to recognize that all PyQtGraph objects are just standard Qt 
objects at their core, and simply create and position a QLabel object as 
desired, using standard Qt commands based on the position of your plot area.

Like I said, not necessarily a good approach, just spitballing possibilities :-)
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145

> On Mar 25, 2021, at 7:32 AM, Jeffrey Nichols <[email protected]> 
> wrote:
> 
> I'd seen that example, but it looked like it was attaching text at specific 
> data coordinates, and the text moves with the data.
> 
> I wanted my text to be floating over the data (or more likely, floating over 
> an absence of data) centered in the visible plot area, not attached to any 
> specific point.
> 
> Looking at that example again, I noticed the comment in at the top of the 
> file: "For text that can be placed in a layout, use LabelItem". I looked 
> through the source code for LabelItem usage examples but I didn't see much.
> 
> On Thursday, March 25, 2021 at 10:43:13 AM UTC-4 [email protected] 
> <http://gmail.com/> wrote:
> Hi Jeff,
> I think the text item example might fit your needs. 
> 
> 
> On Thursday, March 25, 2021 at 2:49:30 PM UTC+1 [email protected] 
> <applewebdata://ADC4C93E-670B-41CD-BA82-43072A3F7ABE> wrote:
> 
> I've got what I hope is a simple question here. 
> 
> Background: I've got a pair of plots, and I can add axis labels using 
> setLabel() and I can change the plot title using setTitle(). These work 
> great. 
> 
> I'd like to do something similar during error conditions and have the text 
> right in the middle of the plot. Seems like it should be easy enough, as 
> pyqtgraph is very flexible. I looked through the API and I didn't see 
> anything quite right though. I don't want to attach it to a point in the 
> graph, because usually there aren't points when I want to show the error. 
> Ideally the message would be centered right in the middle of where the data 
> would normally be displayed.
> 
> What's the easiest way to accomplish this? 
> 
> Thanks,
> Jeff
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pyqtgraph" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pyqtgraph/b8feddee-ff70-4181-a14e-c15b15b8b724n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/pyqtgraph/b8feddee-ff70-4181-a14e-c15b15b8b724n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/2A8688CE-EC7B-4AF4-BE6F-68FF1F60B9A8%40alaska.edu.

Reply via email to