I'm using a multiplot with two boxes for two sets of data as legend. However, I came across the following problem: when using a grid, the second box is always behind the grid. Using the following code (borrowed from another question in SE and modified):
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"
The output you get is:

I would like the second box to be opaque to the grid, just like the first one. The command #unset grid doesn't do anything since there is no grid if you disable xtics and ytics.
Use opaque at the second key:
...
set key at graph 0.5, 0.5
set key opaque
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With