Use TeX in plotting




On Sat, 8 May 2010, Dmitry Vinokurov wrote:

< Hello,
< 
< I wonder is it possible to use TeX or LaTeX syntax to write legend and labels
< for my graphs? And if possible, how it may be done?
 
Maxima uses Gnuplot, which supports such constructions.
I assume that you want to create a graphics file to be
included in a LaTeX document.

/* create a LaTeX source */
plot2d(sin(x),[x,0,2*%pi],[xlabel,"$\\bf{x}$"],[ylabel,"$y$"],[gnuplot_term,eepic],[gnuplot_out_file,"sin.eepic"]);

/* create an EPS file and use psfrag */
plot2d(sin(x),[x,0,2*%pi],[xlabel,"x"],[ylabel,"y"],[legend,"S"],[psfile,"sin.ps"]);

in LaTeX source

\usepackage{psfrag}
...
{
\psfrag{x}{$x$}
\psfrag{y}{$y$}
\psfrag{S}{$y=\sin(x)$}
..graphics command
}

It is also possible to access the fonts used by latex directly in
gnuplot, but this is a bit more involved.

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.