For loop 带有word函数的Gnuplot fillstyle模式出现错误

For loop 带有word函数的Gnuplot fillstyle模式出现错误,for-loop,gnuplot,For Loop,Gnuplot,我正在绘制一个具有不同列的文件,并使用gnuplot的for循环。我想完全控制图形的外观,因此我使用set line style来控制线条的颜色。我想对模式填充做同样的操作,但似乎gnuplot不可能做到这一点 到目前为止,我已经找到了这个解决方案,但由于未知的原因,它也不起作用: set terminal cairolatex standalone pdf set style line 2 linecolor rgbcolor "#F9E0B0" linewidth 2 pt 13 # etc

我正在绘制一个具有不同列的文件,并使用gnuplot的for循环。我想完全控制图形的外观,因此我使用
set line style
来控制线条的颜色。我想对模式填充做同样的操作,但似乎gnuplot不可能做到这一点

到目前为止,我已经找到了这个解决方案,但由于未知的原因,它也不起作用:

set terminal cairolatex standalone pdf
set style line 2 linecolor rgbcolor "#F9E0B0" linewidth 2 pt 13
# etc ... up to 10

pat="0 2 4 7 2 4 7 2 4 7" ## An attempt to define the pattern style I want
set style fill pattern 1 border ## this control the first pattern, then the next ones are incremented but it cannot control each index

set output "myplot.tex"
plot for [i=2:10] "myfile.dat" index 0 u i:xtic(1) fillstyle pattern int(word(pat, i)) ls i ti columnheader ## The color is controlled according to me via the linestyle, but the fillstyle does not work

## An alternate solution giving a little bit of control but not fully satisfactory since I want to avoid the pattern 3
# plot for [i=2:10] "myfile.dat" index 0 u i:xtic(1) fillstyle pattern i%3+1 ls i ti columnheader 
unset output
使用此解决方案,我会遇到以下错误:
意外或无法识别的令牌

知道为什么word在fillstyle模式后失败吗,或者有人知道如何为每个数据指定模式吗


编辑:我使用的是gnuplot 5.0,解析器希望紧跟在“fillstyle”后面的实体是一个数字,但它不将int(“foo”)识别为数字。那是一只虫子。您可以通过使用语法来解决这个问题

fillstyle pattern 0+word(pat,i)