Hello!
I'm working on a project for a company I'm interning at, and in my window
I'm including a PlotWidget that simply draws points connected by lines.
I've set it up so that whenever the user holds their mouse over the graph,
it will display the graph coordinates on a Label, as shown in the picture
I've attached.
I'd like to include a way for the "setLogMode" to be turned on and off with
a QCheckBox. However, when the user moves the mouse over the plot with the
log mode turned on, the number on the "y" label only shows the exponent
value (the values are between 10^3 and 10^4, so it shows values like 3.245,
3.892, etc.), when I'd like it to show the real value instead. Here's the
code for the mouse moved function (that works properly for non-log mode:
def mouseMoved(self, evt):
pos = evt[0] ## using signal proxy turns original arguments into a
tuple
if self.pw.sceneBoundingRect().contains(pos):
mousePoint = self.vb.mapSceneToView(pos)
yPoint = "{:.4e}".format(mousePoint.y())
self.graphcoordinates.setText("<span style='font-size: 12pt'>x
= %0.4f, <span style='color: red'>y = %s</span>" % (mousePoint.x(),
yPoint)) # This simply displays the mouse coordinates
self.vLine.setPos(mousePoint.x()) #sets the position of the
crosshair lines
self.hLine.setPos(mousePoint.y())
Help with this would be greatly appreciated. I couldn't find anything
online regarding this problem of mine. Thank you!
Arun
--
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/f8e9c0ca-5adb-42f8-9996-a5b20387b4b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.