Gnuplot: more than two datasets in the same chart with 2 axes

I have several datasets that I want to build in one shape:

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 easy to do on gnuplot if you only have two datasets. The first dataset uses yrange (with its axis on the left), and the second dataset uses y2range (with the axis on the right side).

Now here is the question. I want to build datasets data1a.txt , data1b.txt and data1c.txt using yrange and data2.txt using y2range . How to do this on a single figure with two y-axes?

+8
range plot gnuplot axes
source share
1 answer

As described here :

 plot {<ranges>} {<function> | {"<datafile>" {datafile-modifiers}}} {axes <axes>} {<title-spec>} {with <style>} {, {definitions,} <function> ...} 

you can see that axes are used in the plot command. After setting the ranges of your y-axes with

 set yrange [y1min:y1max] set y2range [y2min:y2max] 

you can specify which axis you want to use in your chart with

 plot "data.txt" axes x1y1 

if you want to build it with the first y axis or

 plot "data.txt" axes x1y2 

if you want to build it with the second y axis.

Also see this example of using multiple axes in gnuplot.

+11
source share

All Articles