在Python中更改数组索引
我有一个好的形象。它的数组维数为300 x 8500。当我绘制图像时,它显示y轴范围从0到300,x轴范围从0到8500。如果我想将x轴更改为1385.9--1213.9,那么如何在python中实现?我不想只更改索引的数据值。目前,在读取fits文件后,我会在Python中更改数组索引,python,arrays,numpy,matplotlib,Python,Arrays,Numpy,Matplotlib,我有一个好的形象。它的数组维数为300 x 8500。当我绘制图像时,它显示y轴范围从0到300,x轴范围从0到8500。如果我想将x轴更改为1385.9--1213.9,那么如何在python中实现?我不想只更改索引的数据值。目前,在读取fits文件后,我会 data_a=[:,:] implot= plt.imshow(data_a,cmap=plt.cm.afmhot,interpolation='nearest',aspect='auto',origin='lower') 我认为像i
data_a=[:,:]
implot= plt.imshow(data_a,cmap=plt.cm.afmhot,interpolation='nearest',aspect='auto',origin='lower')
我认为像index=1385.9-numpy.arange(08500,1)*0.02这样的东西可以,但索引只允许整数或布尔值 试试这个
implot= plt.imshow(data_a,cmap=plt.cm.afmhot,
interpolation='nearest',aspect='auto',origin='lower',
extent=[1385.9,-1213.9,0,300])
extent
根据中的边值调整x
和y
标签
extent = [horizontal_min,horizontal_max,vertical_min,vertical_max]
索引
不是数据数组的属性;这只是一种计算行和列的方法。有什么进展吗。。。下面的答案有用吗?谢谢。对是的。对不起,我知道这是一个旧线程(很久以前)。我忘了回答。