我正在尝试在 gnuplot 中重新创建此图(相册中的第二个图像),但在重现他们在 x 轴上使用的比例时遇到了问题。这段代码是我迄今为止的进展:
#!/usr/local/bin/gnuplot
reset
# set svg output
set terminal svg size 410,250 fname 'Verdana, Helvetica, Arial, sans-serif' \
fsize '9' rounded dashed
set output 'out.svg'
set xlabel 'x axis label'
set ylabel 'y axis label'
set xrange [0:200000]
set yrange [0:30000]
set xtics (\
'0' 0, '10K' 10000 ,'50K' 50000, '100K' 100000, '200K' 200000)
set ytics 2000
plot 'data.dat' using 1:2 t 'Example line' w lp ls 1, \
'' u 1:3 t 'Another example' w lp ls 2
Run Code Online (Sandbox Code Playgroud)
文件data.dat包含的位置
# x y1 y2
10000 4000 8000
50000 6000 10000
100000 8000 12000
200000 10000 14000
Run Code Online (Sandbox Code Playgroud)
上面的结果就是这个图(第一张图)。可以看出,x 轴上标签之间的间距是不相等的。但我希望它们是平等的,就像我在开始时展示的图表上一样。是否可以在 gnuplot 中重现这种效果?
由于这不是线性或对数刻度,您将需要这样的东西来完成这个技巧(using 0:2使用 1,2,3... 作为 x 坐标)
set xtics ('0' 0, '10K' 1 ,'50K' 2, '100K' 3, '200K' 4)
plot 'data.dat' using 0:2 t 'Example line' w lp ls 1, \
'' u 0:3 t 'Another example' w lp ls 2
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
973 次 |
| 最近记录: |