linearregionitems in log plots are returning unexpected values

24 megtekintés
Ugrás az első olvasatlan üzenetre

Jeremy Webster

olvasatlan,
2018. márc. 7. 13:25:032018. 03. 07.
– 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

olvasatlan,
2018. márc. 9. 3:58:242018. 03. 09.
– 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

olvasatlan,
2018. márc. 9. 12:21:092018. 03. 09.
– pyqtgraph
yes, and similar for the set methods

perhaps in the next release, this will behave as expected.
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet