how can I change the position of the infiniteLine label?

1,107 views
Skip to first unread message

Jeremy Webster

unread,
Jul 18, 2017, 3:15:29 PM7/18/17
to pyqtgraph
The label for the infiniteLine shows up right in the vertical middle of the plot.  That's where all my data is and I'd rather not have the label right over it.  What's the best way (Is it possible) to move it near the top (or bottom) of my plot?


vas...@gmail.com

unread,
Jul 18, 2017, 3:34:11 PM7/18/17
to pyqt...@googlegroups.com
You need to call setValue() function.

example:
i_l = pyqtgraph.InfiniteLine(movable=True, angle=0)
line_position = 1
i_l.setValue(line_position)


read the documentation http://www.pyqtgraph.org/documentation/graphicsItems/infiniteline.html

On Tue, Jul 18, 2017 at 9:15 PM, Jeremy Webster <jweb...@gmail.com> wrote:
The label for the infiniteLine shows up right in the vertical middle of the plot.  That's where all my data is and I'd rather not have the label right over it.  What's the best way (Is it possible) to move it near the top (or bottom) of my plot?


--
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 pyqtgraph+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/9dde2306-ab4e-49b5-a939-54ec5ed711ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeremy Webster

unread,
Jul 18, 2017, 4:06:15 PM7/18/17
to pyqtgraph
I believe you misunderstood the question.  I know how to move the line.  What I want to know is how to move the LABEL of the line.




On Tuesday, July 18, 2017 at 1:34:11 PM UTC-6, Vasilije Mehandzic wrote:
You need to call setValue() function.

example:
i_l = pyqtgraph.InfiniteLine(movable=True, angle=0)
line_position = 1
i_l.setValue(line_position)


read the documentation http://www.pyqtgraph.org/documentation/graphicsItems/infiniteline.html
On Tue, Jul 18, 2017 at 9:15 PM, Jeremy Webster <jweb...@gmail.com> wrote:
The label for the infiniteLine shows up right in the vertical middle of the plot.  That's where all my data is and I'd rather not have the label right over it.  What's the best way (Is it possible) to move it near the top (or bottom) of my plot?


--
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 pyqtgraph+...@googlegroups.com.

vas...@gmail.com

unread,
Jul 18, 2017, 4:27:10 PM7/18/17
to pyqt...@googlegroups.com
il.label.setPosition() ?
look at classInfLineLabel: http://www.pyqtgraph.org/documentation/_modules/pyqtgraph/graphicsItems/InfiniteLine.html
import pyqtgraph
win = pyqtgraph.GraphicsWindow()
pl = win.addPlot()
il = pyqtgraph.InfiniteLine(label='some label', movable=True, angle=0)
pl.addItem(il)
il.label.setPosition(0.1)  # 0.0 to 1.0

if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        pyqtgraph.QtGui.QApplication.instance().exec_()


To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/a9922f5d-d1e5-4354-836d-b73ce4beea5e%40googlegroups.com.

Jeremy Webster

unread,
Jul 18, 2017, 4:46:04 PM7/18/17
to pyqtgraph
Thanks

That works.  I appears to me that InfLineLable isn't documented yet.
Reply all
Reply to author
Forward
0 new messages