I have multiple datasets I want to plot in a single figure:
plot "data1a.txt", "data1b.txt", "data1c.txt", "data2.txt"
I want to have two y-axes with different ranges.
yrange=[0:10]
y2range=[-10:10]
This is easily done on gnuplot if you only have two datasets. The first dataset uses yrange
(with it's axis on the left hand side), and the second dataset uses y2range
(with the axis on the right hand side).
Now here's the question. I want to plot datasets data1a.txt
, data1b.txt
and data1c.txt
using yrange
, and data2.txt
using y2range
. How do I do this on a single figure with two y-axes?
Best Answer
As documented here:
you can see that the
axes
are used in the plot command. After setting the ranges of your y-axes withyou can specify which axis you want to use in your plot with
if you want to plot it against the first y-axis or
if you want to plot it against the second y-axis.
Also see this example of how to use multiple axis in gnuplot.