How I can plot a chart like this ?

I want to plot charts like above (using gnuplot/ matplotlib / anything). I have my data in a text file. Can someone please point me to an example ?
The post is brought to you by lekhonee v0.8
15 Comments to How I can plot a chart like this ?
You can do this with R.
That looks simple enough for gnuplot. I find this site pretty useful (and has a two-axis example):
http://t16web.lanl.gov/Kawano/gnuplot/plot1-e.html#5.2
March 30, 2010
It looks like it was done using GLE.
March 30, 2010
http://zoonek2.free.fr/UNIX/48_R/04.html
try the R progmanning language. it has many plot features. if you are comfortable with matlab R shouldn’t be a big stretch
March 30, 2010
matplotlib can do that easily.
There is an example of a shared x-axis plots in the two_scales.py example file provided in matplotlib docs in Fedora.
-jef
This example is something similar to what you wish to do.
http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html
March 30, 2010
matplotlib has a nice gallery at: http://matplotlib.sourceforge.net/gallery.html
Just click an image to get the code.
This code should pretty much solve your problem:
import numpy as np
import matplotlib.pyplot as pl
x, y1, y2 = np.loadtxt(‘test.dat’, unpack=True)
pl.plot(x, y1, ‘-o’, label=’A 280 nm’)
pl.plot(x, y2, ‘-s’, label=’Enzyme activity’)
pl.legend(loc=’upper center’)
pl.ylabel(‘$A_{280}$ [nm]‘)
pl.text(8, 1, ’1′)
pl.text(10, 0.9, ’2′)
pl.text(40, 0.8, ’3′)
pl.show()
March 30, 2010
Thank you all for the reply :)
Now I am going to try the methods told by you.
GNuPlot can do that with less than 10 lines of code :)
http://t16web.lanl.gov/Kawano/gnuplot/gallery/index-e.html
Ping me if you need help.
March 31, 2010
Try xmgrace.
March 31, 2010
You can use “qtiplot” and use “double y” plot option.
March 31, 2010
+1 for R: it reads you text file and you can do alto multiple plots with lattice
Since everybody pointed at some code, time to show gnuplot power
Reference: http://t16web.lanl.gov/Kawano/gnuplot/plot1-e.html#5.2
The below 4 lines will get you the two axes. Cosmetic changes can be done to make the graph look best.
gnuplot> set xrange [0:2*pi]
gnuplot> set yrange [-1:1]
gnuplot> set y2range [0:1]
gnuplot> plot sin(x) axis x1y1, \
sin(x)**2 axis x1y2
April 2, 2010
that’s a GLE graph.
April 2, 2010
I would recommend RRDTool http://oss.oetiker.ch/rrdtool/.
It has bindings for a lot of languages.
good luck
March 30, 2010