python - pyqtgraph changing limits on displayed color scale using pyqtgraph.image() -
i'm trying change scale of data being displayed (not sure if called) want change range circled in red 3-6 default when launches

everything i've read suggests should simple grabbing imageview object , calling setlevels() shown here. problem can't find imageview object found within imagewindow.
here's initial code
imv = pg.image(amps) okay = imv.imageitem imv.view.setaspectlocked(ratio = 4) print( vars(imv)) imv.setlimits(3,6) win = qtgui.qmainwindow() #im.setlookuptable(lut) if __name__ == '__main__': import sys if (sys.flags.interactive != 1) or not hasattr(qtcore, 'pyqt_version'): qtgui.qapplication.instance().exec_() but says imagewindow has no attribute setlimits.
i tried searching imageview running
print(vars(imv)) but closest thing find imageitem but
imv.imageitem.setlevels(3,6) raises error of "levels argument must 1d or 2d". makes me think not right path.
thanks help
edit:
i tried
imv.imageitem.setlevels((3,6)) which produces following

the range correct on data, legend on right not updated correctly
imagewindow subclass of imageview, same methods should apply. documentation here: http://www.pyqtgraph.org/documentation/widgets/imageview.html#pyqtgraph.imageview.setimage
these different ways of writing approximately same thing:
# 1: pg.image(data, levels=[3, 6]) # 2: imv = pg.image(data) imv.setlevels(3, 6) # 3: imv = pg.imageview() imv.setimage(data, levels=[3, 6])
Comments
Post a Comment