linearregionitems in log plots are returning unexpected values

24 views
Skip to first unread message

Jeremy Webster

unread,
Mar 7, 2018, 1:25:03 PM3/7/18
to pyqtgraph



In the plot attached, the f1 and f2 spin boxes are showing the tuple values of the linearRegionItem.getRegion() call.  They apparently show the power of the the boundries, and not the actual value of the boundary as expected. 

A similar thing happens when adding a linearregionitem to a plotwidget

lri = LinearRegionItem(values=[1,2], orientation='vertical')
myplot.setLogMode(x=True, y=True)
myplot.addItem(lri)

will make a linearregionitem that goes from 10 to 100

Guillaume William Bres

unread,
Mar 9, 2018, 3:58:24 AM3/9/18
to pyqtgraph
I face the same problem all the time because I also work with logarithmically spaced frequency axis

but we can easily work around it by testing whether log(x) is being used or not:

log_state = my_plot.plotItem.ctrl.logXCheck.isChecked()
[x,y] = my_curve.getData() 

if (log_state):
      x = 10**x
   
 

Jeremy Webster

unread,
Mar 9, 2018, 12:21:09 PM3/9/18
to pyqtgraph
yes, and similar for the set methods

perhaps in the next release, this will behave as expected.
Reply all
Reply to author
Forward
0 new messages