Search code examples
gnuplot

How to place labels on top of the margin?


I am using gnuplot with epslatex terminal. I want to know how to put the label on top of a margin, so that the part of margin under the label is invisible. In the figure I attached, the part of margin under the label is still visible.

the unsatisfied plot


Solution

  • In principle you should be able to tell gnuplot to put your text labels into a box by using the set label ... front boxed, and the specify that the box should be opaque and white using something like set style textbox opaque noborder fillcolor rgb "white". However, this is not supported by all terminals, and epslatex seems to be one of those where this doesn't work.

    However, in epslatex you can simply use latex commands to create a white background box around your label text:

    set term epslatex standalone
    set outp "test.tex"
    set label "\\colorbox{white}{This is a label}" at 6.,0.5 front
    plot sin(x)
    set output
    

    gives

    enter image description here