In Fits file I have three columns called J, H, and K and I would like to plot the relation between J-H and H-K in x and y axes with PYFITS, respectively. How can I make this?
This is a very general and basic question.
First you need to open your FITS file and plot, here is an example program:
import pyfits
import matplotlib.pyplot as plt
# Load the FITS file into the program
hdulist = pyfits.open('Your FITS file name here')
# Load table data as tbdata
tbdata = hdulist[1].data
fields = ['J','H','K'] #This contains your column names
var = dict((f, tbdata.field(f)) for f in fields) #Creating a dictionary that contains
#variable names J,H,K
#Now to call column J,H and K just use
J = var['J']
H = var['H']
K = var['K']
#To plot J Vs H and H Vs K and so on
plt.plot(J,H,'r')
plt.title('Your plot title here')
plt.show()