Reputation: 69
I have a fits image. It has an array dimension of 300 x 8500. When I plot the image, it shows the y-axis range from 0 to 300, x-axis range from 0 to 8500. If I want to change the x-axis to 1385.9--1213.9, how do you do it in python? I don't want to change the data value just the index. Currently, after reading in the fits file, I do
data_a=[:,:]
implot= plt.imshow(data_a,cmap=plt.cm.afmhot,interpolation='nearest',aspect='auto',origin='lower')
I would think something like the index = 1385.9 - numpy.arange(0,8500,1)*0.02
, will do but only interger or boolean is allowed for index.
Upvotes: 1
Views: 800
Reputation: 3363
Try this
implot= plt.imshow(data_a,cmap=plt.cm.afmhot,
interpolation='nearest',aspect='auto',origin='lower',
extent=[1385.9,-1213.9,0,300])
extent
adjusts the x
and y
labeling according to the edge values in
extent = [horizontal_min,horizontal_max,vertical_min,vertical_max]
Upvotes: 2