I'd like to allow my software's users to view their data with a log scale.
However, very often, their data includes 0 values (negative values should
never occur). When the user right-clicks->Plot-Options->Transforms->Log-X,
the pen disappears (see the minimal working example below, removing the
pseudocode lines).
I'd like to put in a simple data filter such that when the user tries to
put in a transform on the y-axis, I remove the <=0 points from the data
that should be plotted. How can I attach a signal to the user performing
right-clicks->Plot-Options->Transforms->Log-X such that I can change the
data? Should be something like the following, but I don't know what the
slot would be:
```
from PySide2 import QtGui
import pyqtgraph as pg
import numpy as np
x = np.array([1, 2, 3])
y = np.array([10, 0, 6])
app = QtGui.QApplication([])
plot = pg.PlotWidget()
line_ref = plot.plot(x, y)
# begin pseudocode
plot.logY_Slot.connect(update_log_plot) # What should this be?
def update_log_plot():
if plot.logY: #
What should this be?
line_ref.setData(x[y>0], y[y>0])
else:
line_ref.setData(x, y)
# end pseudocode
plot.show()
app.exec_()
```
--
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/d247ab05-66e3-423a-8a19-bfd53fb846ccn%40googlegroups.com.