2013-05-13 451 views
1

我有gnuplot图的麻烦。轴x和y写得不好。 bash中的脚本就在这里。Gnuplot坐标轴x和y

echo "set terminal png 8; 
set output name.png 
set multiplot 
set timefmt '%s'; 
set title \"$LEGEND\"; 
set xdata time; 
set format x$CASOVY_FORMAT; 
set xrange [:] 
set yrange [:] 
unset colorbox 
plot '$docasnyadr/data_timestamp_1' u 1:2 t '' w lines lw 1 lc 1 
plot '$docasnyadr/data_timestamp_2' u 1:2 t '' w lines lw 1 lc 2 
plot '$docasnyadr/data_timestamp_3' u 1:2 t '' w lines lw 1 lc 3" | gnuplot 

数据的文件格式为timestamp any_number。这里是一张图片: enter image description here

我需要自动xrange和自动yrange。你可以帮我吗?

回答

0

有两点要注意:

看起来要绘制三组数据在同一个不同颜色的情节。在这种情况下,你不一定需要的multiplot(这是为了使在不同的绘图区域完全独立的地块),所以你可以使用命令

plot '$docasnyadr/data_timestamp_1' u 1:2 t '' w lines lw 1, \ 
'$docasnyadr/data_timestamp_2' u 1:2 t '' w lines lw 1, \ 
'$docasnyadr/data_timestamp_3' u 1:2 t '' w lines lw 1 

,而不是三个情节命令。这种方式线颜色也自动增量。

您的情节中的x轴看起来很奇怪,不是因为自动调整问题,而是因为y个标记对于某些图(例如'98')和三个数字(例如'103')有两个数字。

如果你想在三个数据是彼此相邻,你可能会需要手动抵销:

plot '$docasnyadr/data_timestamp_1' u 1:2 t '' w lines lw 1, \ 
'$docasnyadr/data_timestamp_2' u 1:($2+offset1) t '' w lines lw 1, \ 
'$docasnyadr/data_timestamp_3' u 1:($2+offset2) t '' w lines lw 1 

否则,你可能有多个y轴实验。

+0

谢谢,它的工作原理 – 2013-05-13 21:14:03