Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove thing from gnuplot's legend

Tags:

gnuplot

I have to plot three implicit functions using gnuplot, I use this:

set contour
set cntrparam levels discrete 0
set view map
unset surface
set isosamples 1000,1000
set xrange [-5:7]
set yrange [-15:15]
set xlabel "x"
set ylabel "y"
splot y**2-x**3+15*x-13 t "t1", y**2-x**3+15*x-sqrt(4.*15.**3/27.) t "singular", y**2-x**3+15*x-30 t "t2", y**2-x**3+15*x-13 t "t3"

And the output is this: enter image description here

The program is writing the 0 of the level of the surface in the legend but I just want the title parameter passed to the splot command. As the three surfaces are actually the same at a different height, I could change set cntrparam... line to draw the three of them, but what I want to do is to remove the numbers and make it write just text. How can I do that?

like image 457
MyUserIsThis Avatar asked Oct 31 '22 05:10

MyUserIsThis


1 Answers

You cannot directly manipulate the contour level labels with any text. Just write out the contoured data to a temporary file using set table... and then plot this data file as usual. Here, you can now distinguish between different contour levels using index:

set contour
set cntrparam levels discrete 0
set view map
unset surface
set isosamples 1000,1000
set xrange \[-5:7\]
set yrange \[-15:15\]
set xlabel "x"
set ylabel "y"

set table 'contour.dat'
splot y**2-x**3+15*x-13 t "t1", y**2-x**3+15*x-sqrt(4.*15.**3/27.) t "singular", y**2-x**3+15*x-30 t "t2", y**2-x**3+15*x-13 t "t3"
unset table

set style data lines
plot 'contour.dat' index 0 title 't1', '' index 1 title 'singular', '' index 2 title 't2', '' index 3 title 't3'

Result image

like image 187
Christoph Avatar answered Nov 17 '22 14:11

Christoph