1

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.

2
  • index is not a property of the data array; it is just a way of counting rows and columns. Commented Apr 9, 2015 at 17:05
  • Any progress? ... did the answer below help? Commented Apr 17, 2015 at 8:33

1 Answer 1

2

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]
Sign up to request clarification or add additional context in comments.

1 Comment

thank you. Yes. it did. Sorry, I know that this is an old thread (long time ago). I forgot to reply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.