> I have a graph where the axes are $\theta$ and $\Gamma$ and I want
> them both as the Greek letters, and in mathematical italic. How do I
> do that?
Depends entirely on the output terminal type.
postscript? latex? png? on the screen?
postscript enh
Hmm, why do you want them in italic? Even LaTeX uses an upright symbol
when you type $\Gamma$.
If you still want it italic, you must find a font that has such an
italic \Gamma (serif or sansserif?) and that fits your other font used
for the axes. The standard Symbol font only has an upright \Gamma.
Then you can include the font with fontfile 'font.pfb' and use it.
Christoph
OK, you are right about $\Gamma$. But $\theta$ is italic. I thought
that it is possible to use LaTeX-like strings in gnuplot. I also have
a couple of other symbols, that I want italicised, that LaTeX does
like that.
So, if the only way is to use this font.pfb, how do I do that? And
will that then also apply to the axis numbers?
I attach the picture in which I want the axis labels in LaTeX maths
font (i.e. italicised) - except \Gamma, it seems.
Sorry, that didn't work. Ignore the bit about an attachment.
It did work :-)
When you include other fontfiles you can use them for the whole plot.
Another, probably better, way is to use the epslatex terminal. Then you
can typeset everything with LaTeX-like strings (this is probably what
you were looking for).
To give you some examples:
set terminal epslatex standalone
set output "ex-file.tex"
set xlabel "$x$"
set ylabel "$\\sin(x)$"
set xrange[-pi:pi]
set xtics ("$-\\pi$" -pi, "0" 0, "$\\pi$" pi)
plot sin(x) t ''
Then you must run
gnuplot ex-file.gp && latex ex-file.gp && dvips ex-file.dvi
Then, every string is typeset using the roman Computer-Modern fonts. But
with the 'header' option you can add any package and command you want.
In my opinion, all labels should still be typeset in a 'sans-serif' font
which you can get as follows
set terminal epslatex standalone header \
"\\usepackage[T1]{fontenc}\n\\usepackage{cmbright}\\renewcommand{\\familydefault}{\\sfdefault}"
set output "plotsin.tex"
set xlabel "$x$"
set ylabel "$\\sin(x)$"
set xrange[-pi:pi]
set xtics ("$-\\pi$" -pi, "0" 0, "$\\pi$" pi)
plot sin(x) t ''
The cmbright package is needed, because the CM-Super fonts do not have a
sans-serif math font (if you omit this part in the header string, all
numbers will be sans-serif, but the 'pi' in the labels and the x- and
y-labels will be roman)
Hope that helps you :-)
Christoph
I tried this out, using the now modified script new3, as attached,
which uses the data file grid.dat, also attached. It produces two
new files, new3.eps (just the grids) and new3.tex. When I then type
in, translating from your line,
gnuplot new3.gp && latex new3.gp && dvips new3.dvi
I get the complaint, reasonably enough, that new3.gp does not exist.
What am I missing?
Gnuplot didn't like the option standalone. Does this mean that my
gnuplot is out of date? It says it is
Version 4.0 patchlevel 0
last modified Thu Apr 15 14:44:22 CEST 2004
System: Linux 2.6.18.2-34-default
Could this be my problem with this?
It was an error in my commandline. You should run latex on the file new3.tex
> Gnuplot didn't like the option standalone. Does this mean that my
> gnuplot is out of date? It says it is
>
> Version 4.0 patchlevel 0
> last modified Thu Apr 15 14:44:22 CEST 2004
> System: Linux 2.6.18.2-34-default
Well, it is not really a problem, but with the 'standalone' option it is
less work ;-)
Without this option you must create a second .tex file which includes
the file generated with gnuplot.
Note, that with the epslatex terminal you cannot use the enhanced option
of postscript driver -> '{/=25 ...}' because all the text is typeset
with LaTeX. Every backslash of the LaTeX macros must be escaped to
appear correctly in the output -> set label "$\\Gamma$"
Given your datafile 'grid.dat' the following workflow should work:
,,,
(o o) File: plot.gp
-------------------------------oOO--(_)--OOo---------------------------
set term epslatex
set output 'plot-inc.tex'
set nokey
#
# Multiplots of the two grid systems:
#
set size square
set multiplot
set origin 0, 0
set size 0.7,0.7
set xrange [0:6.5]
set yrange [0:6.5]
set format x '%g'
set format y '%g'
set lmargin 10
set bmargin 5
set xtics (1, 2, 5)
set label 1 '0' at -0.35,-0.26
set ytics 2, 2, 6
set label 2 '$R$' at 3, -0.9
set label 3 '$Z$' at -1.3, 3
plot 'grid.dat' using 3:4 w l
#
set origin 0.5, 0
set size 0.7, 0.7
set nolabel
set xrange [0:pi/2]
set xtics ("0" 0, "$\\pi/2$" pi/2)
set yrange [0:1]
set lmargin 5
set bmargin 5
set noxtics
set ytics 0, 1, 1
set label 1 '0' at -0.02, -0.07
set label 2 "$\\theta$" at 0.8, -0.1
set label 3 "$\\Gamma$" at -0.18, 0.6
plot 'grid.dat' w l
---------------------- end file --------------------------------------
call this file with gnuplot:
gnuplot plot.gp
This creates two files: plot-inc.eps and plot-inc.tex
As gnuplot 4.0 does not seem to understand the 'standalone' option, you
must create another .tex file which includes the one created from gnuplot:
,,,
(o o) File: plot.tex
-------------------------------oOO--(_)--OOo-------------------------
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\usepackage{graphicx}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\input plot-inc
\end{document}
---------------------- end file --------------------------------------
call this with latex and dvips
latex plot.tex && dvips plot.dvi
and you get the desired output file. This gives you a file 'plot.ps'
which bounding box is not correct. A better option, which requires the
package pst-eps.sty, is to use the following file:
,,,
(o o) File: plot-enh.tex
-------------------------------oOO--(_)--OOo-------------------------
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\usepackage{graphicx}
\usepackage{pst-eps}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\begin{TeXtoEPS}
\input plot-inc
\end{TeXtoEPS}
\end{document}
---------------------- end file --------------------------------------
and call it with
latex plot-enh.tex && dvips -E plot-enh.dvi -o plot-enh.tmp.eps &&
epstool --copy --bbox --output plot-enh.eps plot-enh.tmp.eps
(on my debian-computer 'epstool' is shipped with an equally named
package and adjusts the bounding box when call as above. If you don't
have it, plot-enh.tmp.eps already contains the correctly fomatted output
but with incorrect bounding box)
Then you get a nicely typeset EPS-file 'plot-enh.eps' with correct
bounding box.
Hope this guide helps you and does not contain more tpyos ;-)
Christoph