I have two files that has the time as x axis and a value. I need to overlay these two on a single plot. Currently i tried it using GNUplot, but struck in the middle. Here is a sample file
01:03:05 6
01:03:15 6
and another file
01:03:55 6
01:04:10 6
I need to plot these two files (say x mark and some other symbol for differentiation) in a single plot. I dont know if it is possible to do that in GNUplot. Currently I have created two grids for each file. But I need both in a single plot. Here is what I have written
set multiplot layout 1,2 # engage multiplot mode
set xdata time ## these three lines control how gnuplot
set timefmt '%H:%M:%S' ## reads and writes time-formatted data.
set format x '%H:%M:%S' ##
set xtics 05 # make time spacing of 2 minutes
plot 'AAA' u 1:2 # plot the first data set
plot 'BBB' u 1:2 # plot the second data set
unset multiplot
Can anyone familiar with GNUplot or any other tool (working in linux) can help me.
5.9 Does gnuplot support multiple y-axes on a single plot? Yes. 2D plots can have separate x axes at the bottom (x1) and top (x2), and separate y axes at the left (y1) and right (y2).
The command set multiplot places gnuplot in the multiplot mode, in which several plots are placed on the same page, window, or screen.
Matplotlib = ease of use, Gnuplot = (slightly better) performance. I know this post is old and answered but I was passing by and wanted to put my two cents. Here is my conclusion: if you have a not-so-big data set, you should use Matplotlib. It's easier and looks better.
In order to plot multiple lines in a single plot, simply put them in a single plot command like
plot 'AAA' u 1:2, 'BBB' u 1:2
There are numerous examples out there that give you a good start with gnuplot. This one for example shows how to plot multiple lines in one plot.
The multiplot
command you are using in your script would also make it possible to have multiple plot windows like shown here. You can adjust the position of each subplot by:
set size XSIZE,YSIZE #see `help set size`
set origin XORIGIN,YORIGIN #see `help set origin`
or (if you have gnuplot 4.2 or newer):
set lmargin at screen XMIN #see `help margin`
set rmargin at screen XMAX
set tmargin at screen YMAX
set bmargin at screen YMIN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With