Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have tried:

\font\figfn="Myriad Pro:mapping=tex-text" at 8pt
\input tikz
\tikzset{font=\figfn}
\input pgfplots
\pgfplotsset{
  width=\hsize,
  compat=1.3,
  every axis label={font=\figfn},
  tick label style={font=\figfn},
  label style={font=\figfn},
  legend style={font=\figfn}
}
\tikzpicture[font=\figfn]
\axis[ybar,bar width=2pt,x tick label style={/pgf/number format/1000 sep=}]
  \addplot coordinates {(2009,18) (2008,28) (2007,12) (2006,9) (2005,11)
    (2004,12) (2003,4) (2002,4) (2001,5) (2000,10) (1999,5) (1998,2) (1997,4)
    (1996,5) (1995,11) (1994,11) (1993,14) (1992,10) (1991,10) (1990,4)};
  \addplot coordinates {(2009,13) (2008,15) (2007,13) (2006,16) (2005,11)
    (2004,7) (2003,4) (2002,4) (2001,2) (2000,6) (1999,11) (1998,5) (1997,13)
    (1996,10) (1995,3) (1994,6) (1993,16) (1992,15) (1991,15) (1990,7)};
\endaxis
\endtikzpicture
\bye

No font changes (you can see my growing frustration from the above code, where I try to apply the font in every place I can imagine).

share|improve this question
    
I hope the fonts tag isn't too far-fetched for this question. ;-) –  lockstep Oct 1 '11 at 11:24
    
@lockstep: Grah, I always forget to add some painfully obvious tag. Thanks! :-) –  morbusg Oct 1 '11 at 11:30

1 Answer 1

up vote 6 down vote accepted

Here is an experiment of mine:

%\font\figfn="Myriad Pro:mapping=tex-text" at 8pt
\def\figfn{\tt}
\input tikz
\tikzset{font=\figfn}
\input pgfplots
\pgfplotsset{
  width=\hsize,
  compat=1.3,
  every axis label={font=\figfn},
  tick label style={font=\figfn},
  label style={font=\figfn},
  legend style={font=\figfn},
  title=A title,
  xticklabel style={/pgf/number format/assume math mode},
  yticklabel style={/pgf/number format/assume math mode},
}
\tikzpicture[font=\figfn]
\axis[ybar,bar width=2pt,x tick label style={/pgf/number format/1000 sep=}]
  \addplot coordinates {(2009,18) (2008,28) (2007,12) (2006,9) (2005,11)
    (2004,12) (2003,4) (2002,4) (2001,5) (2000,10) (1999,5) (1998,2) (1997,4)
    (1996,5) (1995,11) (1994,11) (1993,14) (1992,10) (1991,10) (1990,4)};
  \addplot coordinates {(2009,13) (2008,15) (2007,13) (2006,16) (2005,11)
    (2004,7) (2003,4) (2002,4) (2001,2) (2000,6) (1999,11) (1998,5) (1997,13)
    (1996,10) (1995,3) (1994,6) (1993,16) (1992,15) (1991,15) (1990,7)};
\endaxis
\endtikzpicture
\bye

it worked fine. You'll note that I substituted your font with a default font. This works directly for the graph's title.

The tick labels are trickier, though: the correct way would be to exchange the MATH FONT because they are typeset in math mode by default. For LaTeX, this typically requires to load a different package which does the job (there are other questions related to this very question throughout LaTeX internet forums).

If you do want to use a text font for tick labels, you have to use text-mode for these labels. The /pgf/number format/assume math mode key used in the example above tells the number formatter that it does not need to change into math mode - and since you did not explicitly activate math mode, it will typeset tick labels with the text font (for pgfplots revision older than 1.5, you will have to add xticklabel=\pgfmathprintnumber{\tick} and yticklabel=\pgfmathprintnumber{\tick} to get the same effect).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.