When plotting data on 2 different axes, the pointis often to compare relative variations of data in different units. Thus it is often more correct to plot them with the same position of the zero, so that relative variations are to scale.
In gnuplot, this is easily done for positive data, setting ymin=y2min=0, but I can find no way to do it with autoscale for data that can change sign.
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
I can do it manually of course :
[code]
plot "data2.dat" axes x1y2
SAVE_Y2_MIN=GPVAL_Y2_MIN
SAVE_Y2_MAX=GPVAL_Y2_MAX
plot "data1.dat" axes x1y2
max(a,b)=(a>b)?a:b
a=max(SAVE_Y2_MIN/GPVAL_Y_MIN,SAVE_Y2_MAX/GPVAL_Y_MAX)
set y2range [GPVAL_Y_MIN*a:GPVAL_Y_MAX*a]
replot "data2.dat" axes x1y2
[/code]
Last edit: Anonymous 2013-11-20
Version 4.7 now supports a command "set link {x2|y2}" that I think will do what you want. For example, if you wanted y axis data in Farenheit and y2 axis data in Centigrade, but aligned so that 32F is parallel to 0C
c2f(y) = 32. + 9.*y/5.
f2c(y) = (y-32.) * 5./9.
set link y2 via f2c(y) inverse c2f(y)