与键/图例中的图形相同的Gnuplot linestyle

时间:2014-08-20 19:43:20

标签: gnuplot

我想绘制一个图例/键,它会显示该行上的不同符号。目前我的情节看起来像这样:

Current plot

不幸的是,符号(三角形,矩形和圆形)未显示在键/图例中。如何添加它们?

我使用以下gnuplot脚本:

set title tit   font "palatino,20"
set xlabel xlbl font "palatino,20"
set ylabel ylbl font "palatino,20"
#set logscale x

set output graphfilename.".pdf"
set terminal pdf

set border linewidth 2
set style line 1  lc rgb '#0060ad' lt 1 lw 2 pt 5 # --- blue
set style line 2  lc rgb '#00ad60' lt 1 lw 2 pt 7 # red     .
set style line 3  lc rgb '#ad0000' lt 1 lw 2 pt 9 # green     .

set tics scale 0.8

set key below 

plot file1 using ($1/1000):($2/1000000):($3/1000000):($4/1000000) notitle w yerrorbars ls 1, \
 '' using ($1/1000):($2/1000000) title "Hlog" w lines ls 1,\
file2 using ($1/1000):($2/1000000):($3/1000000):($4/1000000) notitle w yerrorbars ls 2, \
 '' using ($1/1000):($2/1000000) title "Iris" w lines ls 2,\
file3  using ($1/1000):($2/1000000):($3/1000000):($4/1000000) notitle w yerrorbars ls 3, \
 '' using ($1/1000):($2/1000000) title "Java" w lines ls 3

1 个答案:

答案 0 :(得分:2)

一般情况下,如果使用linespoints绘图样式进行绘图,则可以获得线条和点数:

sc(x) = x*1e-6
plot file1 using ($1/1000):(sc($2)):(sc($3)):(sc($4)) notitle w yerrorbars ls 1 ps 0.5, \
     '' using ($1/1000):(sc($2)) title "Hlog" w linespoints ls 1

两次得分,除非你使用透明度,否则不应该成为问题。我还将与错误栏一起绘制的点数缩减到50%,因此您不会遇到抗锯齿问题。

作为另一个选项,你可以只添加标题错误栏,在这种情况下,图例看起来像|---x---|(即也包含错误栏):

sc(x) = x*1e-6
plot file1 using ($1/1000):(sc($2)):(sc($3)):(sc($4)) title "Hlog" w yerrorbars ls 1, \
     '' using ($1/1000):(sc($2)) notitle w lines ls 1