I am trying to build some data from FITS files, and I wanted to know if anyone knows how to focus on certain areas of the graph axis? Here is a sample code:
import pyfits from matplotlib import pyplot as plt from matplotlib import pylab from pylab import * #Assuming I have my data in the current directory a = pyfits.getdata('fits1.fits') x = a['data1'] # Lets assume data1 is the column: [0, 1, 1.3, 1.5, 2, 4, 8] y = a['data2'] # And data2 is the column: [0, 0.5, 1, 1.5, 2, 2.5, 3] plt.plot(x,y)
How could I only build a region from [1.3 to 4] along the x axis?
[1.3 to 4]
Use the plt.axis() function with your limitations.
plt.axis()
plt.axis([xmin,xmax,ymin,ymax])
where x(y)min/max are the coordinate limits for both axes.
x(y)min/max
This question has nothing to do with how you manipulate pyfits , but just a matter of adding
pyfits
plt.xlim(1.3, 4.0)
up to your code up to plt.show()
plt.show()