我已经定义了一个f()我想用于缩放的函数,与logscale类似(但f()不是对数函数).有没有办法自动完成,比如set fscale y?
否则我试图绘制缩放功能:
plot 'data' using 1:(f($2))
Run Code Online (Sandbox Code Playgroud)
但是y轴上的比例显然是错误的.我可以使用我的功能以某种方式重新缩放y轴吗?
我想避免手动设置所有的刻度及其标签(因为我将使用这个脚本来绘制很多不同的图).
小智 6
如果您的数据变化不大,您可以通过预先添加plot命令半自动插入抽搐 set ytics ({"<label>"} <pos> {<level>} {,{"<label>"}...)
只需使用适当数量的点,以便绘图清晰.
例:
$ cat ex.data
0 0
1 3
2 2.2
5 5
7 1.2
9 4
12 9
15 5
Run Code Online (Sandbox Code Playgroud)
所以我们的y数据范围从0到9.
$ gnuplot
G N U P L O T
Version 4.4 patchlevel 3
last modified March 2011
System: Linux 3.2.0-24-generic
Copyright (C) 1986-1993, 1998, 2004, 2007-2010
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
faq, bugs, etc: type "help seeking-assistance"
immediate help: type "help"
plot window: hit 'h'
Terminal type set to 'wxt'
gnuplot> f(x) = x**2
gnuplot> set yrange [0:f(10)]
gnuplot> set ytics ("0" f(0), "5" f(5), "7.5" f(7.5), "10" f(10))
gnuplot> plot "ex.data" u 1:(f($2)) w l
Run Code Online (Sandbox Code Playgroud)
结果:
