Tag Archive

amateur astronomy awk bash be b[e] supergiant cartoon conference convert exoplanet fedora figaro fits fun galaxy history iraf jupiter latex linux lmc massive star matplotlib meteor mypaper ondrejov observatory optical paper peblo photometry planet pro-am pyraf python scisoft skinakas observatory small magellanic cloud smc spectroscopy starlink talk theli ubuntu university of crete video x-ray

Note on how to make multiple plots with pylab

iPython is a great tool to work with Python interactively, imitating a MatLab environment especially when running with matplotlib and numpy [the pylab module, all can be automatically imported by starting pylab like: ipython –pylab]. So you can use it to load data and start playing around with them. Although I like to script more these actions it can be really fast and easy to use it when you just want to see some data and do some minor tasks. But since I don’t write them down these actions I keep forgetting them (well… after a serious number of repetitions this would be of no need … but up to that point let me keep a note!).

So, one of these is hot to make multiple plots. After creating (or most probably loading) the data and making all the necessary steps then we follow this typing:
In [23]: fig = figure()
In [24]: ax = fig.add_subplot(111)
In [25]: p1 = ax.plot(x,y,'r-')
In [26]: p2 = ax.plot(x,z,'g-')
In [27]: draw()

which gives us the following result: