【问题标题】:Gnuplot: Second legend in multiplot behind the gridGnuplot:网格后面的多图中的第二个图例
【发布时间】:2016-06-20 18:45:53
【问题描述】:

我正在使用带有两个框的多图,用于两组数据作为图例。但是,我遇到了以下问题:使用网格时,第二个框总是在网格后面。 使用以下代码(从 SE 中的另一个问题借用并修改):

set term pngcairo
set output "legends.png"

set multiplot

# make a box around the legend
set key box

# fix the margins, this is important to ensure alignment of the plots.
set lmargin at screen 0.15
set rmargin at screen 0.98
set tmargin at screen 0.90
set bmargin at screen 0.15

set xrange[0:2*pi]
set yrange[-1:1]

set grid

# main plot command
plot sin(x) title "sinus"

# turn everything off
unset xlabel     #label off
unset ylabel
set border 0      #border off
unset xtics       #tics off
unset ytics
#unset grid        #grid off

set key at graph 0.5, 0.5
plot cos(x) ls 2 lw 2 title "cosinus"

你得到的输出是:

我希望第二个框对网格不透明,就像第一个框一样。命令#unset grid 不会执行任何操作,因为如果禁用xticsytics,则没有网格。

【问题讨论】:

    标签: plot gnuplot


    【解决方案1】:

    在第二个键处使用opaque

    ...
    set key at graph 0.5, 0.5
    set key opaque
    ....
    

    【讨论】:

    • 就是这样。我没有注意到我在错误的手册(4.2 版)中搜索,没有这样的选项。但是,它在 4.6 手册中:gnuplot.info/docs_4.6/gnuplot.pdf
    猜你喜欢
    • 2019-03-25
    • 2018-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-07
    • 2018-05-06
    • 2011-11-08
    • 1970-01-01
    相关资源
    最近更新 更多