There is a cumbersome workaround for filling the key box with a custom color:
Set custom background color for key in Gnuplot.
However, it seems like semi-transparent colors are not accepted as terminal background.
Well, either you want to see the data and place the legend next to it
or you cover the data with the legend, then the data is not "important".
Putting a semi-transparent legend box on top of data seems to me a bit of a strange mix of both.
The only workaround I see currently is to manually place a semi-transparent box on top of the plot and behind the legend.
The only way I succeeded so far to get this into the right layer stacking order is to plot a box with boxxyerror
and add the legend via keyentry
. You can put the coordinates and size of the box e.g. into the datablock $myBox
. A pretty ugly workaround, but I'm happy to learn about better solutions.
Code:
### manual workaround for semi-transparent fill of key box
reset session
set style fill solid 1.0
set key center at 0,-0 noautotitle box
$myBox <<EOD
0 -0 1.25 1.25
EOD
plot x w filledcurves x1 lc rgb 0xccff0000, \
-x w filledcurves x1 lc rgb 0xcc0000ff, \
$myBox u 1:2:3:4 w boxxy lc rgb 0x77ffffff noautoscale, \
keyentry w filledcurves x1 lc rgb 0xccff0000 ti "x" , \
keyentry w filledcurves x1 lc rgb 0xcc0000ff ti "-x"
### end of code
Result: (wxt terminal)
