Gnuplot中的标签式

时间:2013-09-11 10:49:29

标签: label gnuplot

我使用Perl脚本通过将heredoc管道连接到Gnuplot(版本4.6补丁级别3)来制作几个图形。我有一些问题需要以所需的方式定义标签。我想:

  • 在标签中包含带有格式(sprintf
  • 定义的变量
  • 为不同的地块使用不同的标签
  • 在框中显示标签并在前面显示

我不知道如何定义format specifiers,我也看了label docu1 [链接未正确解释] label docu2This post显示了如何定义框的复杂方法,并且必须为每个标签设置。

很抱歉不仅发布了一个确切的问题,而且它们都与标签风格有关。

到目前为止我的Gnuplot测试:

set style line 1 lt 1 lw 1 lc rgb "#FF4500"
set label 1 'Var1 = sprintf("%5.3f",$Var1)' at graph 0.8, graph 0.95 front font 'Times-Roman,10'
plot "file.dat" u 1:2 ls 1

我的问题:

  • 输出中未解释sprintf。
  • 我不能使用不同的标签,例如我使用不同的ls(linestyle)。
  • 必须以复杂的方式为每个标签定义标签的装帧。
提前谢谢!

1 个答案:

答案 0 :(得分:1)

好的,让我们看看如何排序:

使用sprintf的工作原理如下:

set label 1 sprintf("Var1 = %5.3f",Var1) at ...

set label 1 'Var1 = '.sprintf("%5.3f", Var1) at ...

仅在当前的开发版本4.7中支持盒装标签。您可能会滥用密钥来获取盒装标签(如果您不需要它):

set key opaque box samplen -1 at graph 0.8, graph 0.95 font 'Times-Roman,10'
plot 'file.dat' using 1:2 ls 1 title sprintf('Var1 = %5.3f', Var1)