GNUPLOT可以动态准备索引标签吗?

时间:2013-03-11 09:40:11

标签: gnuplot

我正在绘制GNUPLOT中的多个时段,为了节省空间,我只绘制其中一个图上的轴标签。对于其他图,我使用

覆盖抽搐标签
set ytics ("" -20, "" -15, "" -10, "" -5, "" 0, "" 5, "" 10, "" 15, "" 20)

对于像这样的小规模,它可以手动操作。我可以使用内置的gnuplot(for-loop)动态编写这个“范围”吗?

2 个答案:

答案 0 :(得分:3)

是的,您可以使用类似

的内容
numtics = 8

set macros

ticstring = '('

do for [i=0:numtics] {
    ticstring = ticstring.'"" '.(-20 + i*5).', '
}

ticstring = ticstring.'"" 20)'

set ytics @ticstring

在你的情况下可能更简单的是命令

set ytics format "" 5

每隔5个用一个空白标签放置一个抽头。

答案 1 :(得分:2)

我认为很多更容易做类似的事情:

set multiplot layout 1,2

set xtics format ""   #no x-tic labels on the top plot
plot sin(x)           #top plot

set xtics format "%g" #x-tic labels on the bottom plot
plot cos(x)           #bottom plot

unset multiplot