Search code examples
gnuplottransparencylegend

How to clear the space below a key on a transparent pngcairo gnuplot?


On a plot with a white background , the space below a key can easily be cleared with:

set key opaque

This command actually draws a white rectangle below the key, so that any plotted lines no longer interfere with the inside key.

However, when the output terminal is pngcairo transparent the white rectangle is undesired.

opaque key in gnuplot

How do I obtain a completely transparent plot with the space cleared below the key (no interfering plotted lines)? Or should I file an enhancement request with gnuplot?

What I currently have

ist

What it should be

I have been messing around with GIMP to get this. ImageMagick would work too. However, native support in gnuplot would offer the best graphic result.

soll


Solution

  • For the time being, I created a nearly empty plot with only a transparent key. This plot is then manually combined with the plot containing the opaque key using layers in GIMP. However, I could automate this with ImageMagick to obtain a fully automated solution.

    Here is how to create a plot with just one data point at the origin for each dataset.

    plot \
    "<echo '0 1'" ti "14.000 MHz" ax x1y1 w lines ls 1, \
    "<echo '0 1'" ti "14.174 MHz" ax x1y1 w lines ls 1 lw 2, \
    "<echo '0 1'" ti "14.350 MHz" ax x1y1 w lines ls 1, \
    "<echo '0 1'" ti "21.000 MHz" ax x1y1 w lines ls 4, \
    "<echo '0 1'" ti "21.224 MHz" ax x1y1 w lines ls 4 lw 2, \
    "<echo '0 1'" ti "21.450 MHz" ax x1y1 w lines ls 4, \
    "<echo '0 1'" ti "28.000 MHz" ax x1y1 w lines ls 3, \
    "<echo '0 1'" ti "28.500 MHz" ax x1y1 w lines ls 3 lw 2, \
    "<echo '0 1'" ti "29.100 MHz" ax x1y1 w lines ls 3