I am unable to get sans-serif tick labels with matplotlib 0.87.5 in tex
text mode. I tried with some hints from the list archive but had no success.
So I had a look at the tex-files which are created to render the tick labels,
which look like this:
\documentclass{article}
\usepackage{type1cm}
\renewcommand{\rmdefault}{pnc}
\usepackage{helvet}
\usepackage{courier}
\usepackage{textcomp}
\usepackage[papersize={72in,72in}, body={70in,70in},
margin={1in,1in}]{geometry}
\pagestyle{empty}
\begin{document}
\fontsize{16.000000}{20.000000}{\sffamily $80$}
\end{document}
According to the psnfss doc, the package helvet does not affect the font in
math mode. So I don't see why a tick label '$80$' should be rendered in
sans-serif. I experimented with texmanager.py and added a
\usepackage{cmbright}, which introduces sans-serif fonts in math mode,
and was able to display sans-serif tick labels on screen but the ps-backend
failed with a segfault(!).
I simply added an element to the font_info dict in texmanager.py:
'cmbright' : ('cmbr', r'\usepackage{cmbright}'),
and added 'CMBright' to the list of sans-serif fonts in my .matplotlibrc
It would be nice if some tex-expert could have a look at this or tell me what
I could do to get sans-serif tick labels.
Christian
I am unable to get sans-serif tick labels with matplotlib 0.87.5 in tex
text mode. I tried with some hints from the list archive but had no
success. So I had a look at the tex-files which are created to render the
tick labels, which look like this:
\documentclass{article}
\usepackage{type1cm}
\renewcommand{\rmdefault}{pnc}
\usepackage{helvet}
\usepackage{courier}
\usepackage{textcomp}
\usepackage[papersize={72in,72in}, body={70in,70in},
margin={1in,1in}]{geometry}
\pagestyle{empty}
\begin{document}
\fontsize{16.000000}{20.000000}{\sffamily 80}
\end{document}
According to the psnfss doc, the package helvet does not affect the font in
math mode. So I don't see why a tick label '80' should be rendered in
sans-serif.
Right, most fonts do not provide sans-serif math-mode fonts. And the
ticklabels are always rendered in math mode, such that minus signs are
rendered as minus signs (and not hyphens). That may seem like a minor issue,
but having hyphens for minus signs on a linear x-axis and regular minus signs
on a log y-axis doesnt look professional.
I experimented with texmanager.py and added a
\usepackage{cmbright}, which introduces sans-serif fonts in math mode,
and was able to display sans-serif tick labels on screen but the ps-backend
failed with a segfault(!).
I simply added an element to the font_info dict in texmanager.py:
'cmbright' : ('cmbr', r'\usepackage{cmbright}'),
and added 'CMBright' to the list of sans-serif fonts in my .matplotlibrc
It would be nice if some tex-expert could have a look at this or tell me
what I could do to get sans-serif tick labels.
We tried supporting sans-serif ticklabels with usetex a while back, and it
turned out to be a headache. I'll have a look at cmbright, but no promises.
Darren
···
On Wednesday 22 November 2006 3:27 am, Christian Kristukat wrote: