I want to have a gnuplot with a box on the right top corner like the one below. My difficulties are both:
set term cairolatex eps standalone size 3in,3in
set output 'Q.tex'
set key box opaque samplen 0.5
plot for [i=1:4] sinc(x)**i title sprintf('\tiny${\hat{Q}=%d}$',i) lw 2
The standalone
keyword wraps the output in minimal LaTeX commands so that you can run latex Q
directly. Omit this if you want to produce a LaTeX fragment for including in a larger document.
I show how to construct a formatted title that includes a LaTeX font size. Note that the format uses single quotes rather than double quotes.
This example uses cairolatex eps
because you specifically asked about an eps file. Normallay I would use cairolatex png
or cairolatex pdf
and process afterwards with pdflatex
rather than plain latex
.