我在编译 gnuplot 时遇到了问题,它会忽略我输入的线型而只是假定 lt 1。这是一个示例 .sh 文件:
set term wxt enhanced "arial,16"
set notitle
set xlabel "x"
set ylabel "y"
set size square
set xrange [450:750]
set yrange [450:750]
set key inside top right
set style line 1 lc rgb "#FF0055" lt 1
set style line 2 lc rgb "#2C397D" lt 3
f(x) = x
g(x) = x + 100
plot f(x) ls 2 lw 3 notitle, g(x) ls 1 lw 1 notitle
pause -1
这将产生以下图形:
有人知道哪里出了问题吗?
答案1
问题是无关,但无论如何:
在Gnuplot 4.6
及更早的时候你必须使用set term wxt enhanced dashed "arial,16"
但请注意,这lt 1
不是虚线类型,因此也许可以使用 lt 2 代替。
set term wxt enhanced dashed "arial,16"
set notitle
set xlabel "x"
set ylabel "y"
set size square
set xrange [450:750]
set yrange [450:750]
set key inside top right
set style line 1 lc rgb "#FF0055" lt 2
set style line 2 lc rgb "#2C397D" lt 3
f(x) = x
g(x) = x + 100
plot f(x) ls 2 lw 3 notitle, g(x) ls 1 lw 1 notitle
pause -1
在 Gnuplot 5 中,您可以指定dashtype
一行:
set term wxt enhanced "arial,16"
set notitle
set xlabel "x"
set ylabel "y"
set size square
set xrange [450:750]
set yrange [450:750]
set key inside top right
set style line 1 lc rgb "#FF0055" lt 2 dashtype 2
set style line 2 lc rgb "#2C397D" lt 3 dashtype '..-'
f(x) = x
g(x) = x + 100
plot f(x) ls 2 lw 3 notitle, g(x) ls 1 lw 1 notitle
pause -1