对“plot for”循环中的多个using语句使用相同的颜色

时间:2014-08-01 15:37:52

标签: gnuplot

我的gnuplot脚本中有以下循环来迭代多个文件并绘制一个图形:

files = system("echo $(ls *.csv)")
plot for [f in files] f  using 0:2:xtic(1) with lp ,\
for [f in files] f using 0:2:2 with labels font ',8' offset 1,0.5 notitle "",\
for [f in files] f  using 0:2:3 with yerrorbars title ""

对于每个数据点,绘制一个线点,一个标签和一个yerrorbar。

是否可以为相应的linepoint,yerrorbar和label使用相同的颜色? 如果是,怎么样?

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以使用set linetype cycle ...来定义重复相同模式和颜色的迭代次数:

files = system("echo $(ls *.csv)")

set linetype cycle words(files)

plot for [f in files] f  using 0:2:xtic(1) with lp ,\
     for [f in files] f using 0:2:2 with labels font ',8' offset 1,0.5 notitle "",\
     for [f in files] f  using 0:2:3 with yerrorbars title ""

这是一个简单的例子:

set linetype cycle 2
set samples 10
set key left
set style function linespoints
plot x, 2*x, 3*x, 4*x, 5*x, 6*x

4.6.5的输出是:

enter image description here