[Interest] Bad PyQtGraph clipping on PDF output?

Israel Brewster ijbrewster at alaska.edu
Wed Jun 15 22:11:38 CEST 2022


I have a PlotWidget containing (among other things) a plot (created via plotItem.plot() and a textItem (created directly and added via addItem). Both plot and textItem have ZValue set. If the textItem has a zvalue equal to or greater than the plot, everything is fine. However, if the textItem has a zValue *less* than the plot, then when generating a PDF the plot is drawn shifted slightly, such that it protrudes outside the view box. In both cases, the widgets display fine, it’s only the PDF output that is messed up. See attached images and sample code.

I don’t know yet if this is a problem with the underlying QGraphicsView, or something specific to PyQtGraph. Anyone have any idea how I can fix this (other than always putting the labels on top)?



---
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220615/395dc7c4/attachment-0004.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_out-of-bounds.py
Type: text/x-python-script
Size: 2109 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220615/395dc7c4/attachment-0001.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220615/395dc7c4/attachment-0005.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bad_output.pdf
Type: application/pdf
Size: 44504 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220615/395dc7c4/attachment-0002.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220615/395dc7c4/attachment-0006.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: good_output.pdf
Type: application/pdf
Size: 44504 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220615/395dc7c4/attachment-0003.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220615/395dc7c4/attachment-0007.htm>


More information about the Interest mailing list