Roo*_*ook 28 plot gnuplot axes
是否可以绘制两条曲线,在gnuplot中有两个相应的轴,每个轴都有不同的比例?
例如,y=x**2与y=x**4在相同的曲线图(它们会发生变化足够当与相同的比例绘制的是"不舒服").
小智 46
您可以自动处理轴,而无需自己进行缩放并保持自动缩放:
set terminal jpeg
set output 'graph.jpg'
set xrange [-10:10]
set ytics 10 nomirror tc lt 1
set ylabel '2*x' tc lt 1
set y2tics 20 nomirror tc lt 2
set y2label '4*x' tc lt 2
plot 2*x linetype 1, 4*x linetype 2 axes x1y2
Run Code Online (Sandbox Code Playgroud)
ost*_*sti 11
可以为y和y2(右轴)设置不同的范围,甚至可以独立设置标签/抽搐的颜色.
然后我们简单地将第二个函数除以2(或适当的东西)并设置颜色......如下例所示:
set xrange [-10:10]
set yrange [-20:20]
set y2range [-40:40]
set ytics 10 nomirror tc lt 1
set ylabel '2*x' tc lt 1
set y2tics 20 nomirror tc lt 2
set y2label '4*x' tc lt 2
plot 2*x linetype 1, 4*x/2+.5 linetype 2
Run Code Online (Sandbox Code Playgroud)