Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bring legend to the front in gnuplot

Tags:

gnuplot

Is there a way to bring the key (legend) in gnuplot (epslatex terminal) to the very front? In my plot I experience that some filledcurves are on top of the small line samples of the key so that these are invisible. The lables in the key are placed on top as they are drawn by latex. I know that I could change the order in the plot (filledcurves first) but I actually want that the filledcurves hide the previously drawn lines in the plot itself.

like image 959
highsciguy Avatar asked Mar 21 '12 10:03

highsciguy


2 Answers

Recent gnuplot versions allow you to say "set key opaque", which I think does what you want.

like image 103
sfeam Avatar answered Nov 09 '22 17:11

sfeam


First plot your lines without the key plot x notitle ls 1, then plot your filledcurves, then plot yet the extra lines using the linestyles of the first lines, but so that they are out of the visible area:

set yrange [-10:10]
plot -x notitle ls 2, x**2/3-5 w filledc ls 5, x**2+100 t "first-line legend" ls 2 

This gives you the legend at the top of the filledcurves, but the visible lines below. Hope this works with epslatex too.

like image 33
Jari Laamanen Avatar answered Nov 09 '22 18:11

Jari Laamanen