Issue
I would like to specify the value of my axis on my imageItem.
This is my code :
import numpy as np
import pyqtgraph as pg
app = pg.mkQApp('Example')
layout = pg.GraphicsLayoutWidget(show=True)
plot_item = pg.PlotItem(title="")
image_item = pg.ImageItem()
plot_item.addItem(image_item)
layout.addItem(plot_item)
data = np.random.rand(10,10)
image_item.setImage(data)
axb = pg.graphicsItems.AxisItem.AxisItem(orientation='bottom')
axb.setRange(-100,100)
plot_item.setAxisItems(axisItems={'bottom': axb})
if __name__ == '__main__':
pg.exec()
This code does not work because the bottom axis is not between -100 and 100.
Moreover, is it possible to give an entire array ? In order to have my bottom axis corresponding to [-100,-75,-50,-25,0,25,50,75,100] (or np.linspace(-100,100,100))?
Solution
For ImageItem you should set Transform. See the example on ImageItem documentation.
Answered By - Noushadali
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.