gibarian
gibarian

Reputation: 145

Introduce a box with special symbols in Gnuplot

I want to have a gnuplot with a box on the right top corner like the one below. My difficulties are both:

  1. how to get \hat{Q} in a the legend?
  2. how to add a box containing the titles?

enter image description here

Upvotes: 0

Views: 299

Answers (2)

Ethan
Ethan

Reputation: 15093

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.

enter image description here

Upvotes: 1

Eldrad
Eldrad

Reputation: 743

If you want to include your figure into LaTeX, you should use the terminal cairolatex, then you can include LaTeX code in your plots:

plot "your.data" title '$\hat{Q}=10$'

Concerning your second question, have a look at the manual concerning set key.

Upvotes: 1

Related Questions