Gnuplot, Multiplot: Mix normal and parametric plot with one legend field?

I create overlapping graphs in Gnuplot because I mix normal and parametric graphs (as well as pm3d maps and parametric surfaces). This works fine basically, except for one thing: if both stories have a title, legends usually overlap. A typical example is as follows:

#legends.gp
set term pngcairo enhanced color linewidth 1.5  dashed dashlength 1.4 rounded
set output "legends.png"

set title "legends test"

set multiplot

# make a box around the legend
set key box

set border 15 lw 1

# 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 xlabel "x"
set ylabel "sin(x)"

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

set grid x y

# add single tic at 0.62
set xtics add ("x0" 0.62)

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

# turn everything off
set format x ""   #numbers off
set format y ""
set xlabel ""     #label off
set ylabel ""
set border 0      #border off
unset xtics       #tics off
unset ytics
unset grid        #grid off
unset title       #title off

#plot vertical line at 0.62
set parametric
plot 0.62,t ls 2 lw 2 title "parametric Line"
unset parametric

unset multiplot

Legends.png My question is, is there a simple, basically automatic way to create a single legend for multiple graphs?

PS Sorry, I ended up making the example file more complex than it should have been, showing a few more features that I hope will be useful to future readers.

+3
source share
2 answers

, . :

plot sin(x) title "sinus"

plot sin(x) title "sinus",NaN w l ls 2 lt 2 title "parametric line"

(, notitle title "parametric line").

, gnuplot NaN . , , , . .., , linestyle/type, . , - ...

, , buisness...

set xrange [0:2*pi]
set yrange [-1:1]
set parametric
set trange [-10:10]
plot t,sin(t) title "Hello", 0.62,t title "World"

, , " " ... ( gnuplot "magic" )

+12

gnuplot:

 x = 3, :           set arrow from 3, graph 0 to 3, graph 1 nohead

0

All Articles