来自 gnuplot 代码的美元符号与 epslatex 产生冲突

Dollar-sign from gnuplot code generates conflict with epslatex

为了仅在函数参数(x 轴)的选定区域制作填充曲线,我发现在线程上使用过滤器是个好主意 "Fill several sections below a curve of data in Gnuplot"。

问题在于,使用 epslatex 时,使用 $ 符号指向变量会在尝试使用 latex 进行编译时产生错误。

是否还有其他可能解决该变量?

set samples 100
set xrange [-2:2]
f(x) = -x**2 + 4

set linetype 1 lc rgb '#A3001E'

set style fill transparent solid 0.35 noborder
filter(x,min,max) = (x > min && x < max) ? x : 1/0
plot '+' using (filter(, -1, -0.5)):(f()) with filledcurves x1 lt 1 notitle,\
     ''  using (filter(, 0.2, 0.8)):(f()) with filledcurves x1 lt 1 notitle,\
     ''  using 1:(f()) with lines lw 3 lt 1 title 'curve'

我猜问题出在自动标题中的$,它是由gnuplot 创建的。使用 title 将其覆盖为自定义的:

plot ... title 'my custom escaped title'

或使用 column(1) 代替快捷方式