On Mon, Nov 24, 2008 at 8:37 PM, Zane Selvans <[EMAIL PROTECTED]> wrote:
>
> On Nov 24, 2008, at 5:23 PM, John Hunter wrote:
>
> The first thing I noticed is that all of the LaTeX symbols I have in my
>
> plots are now messed up.  I could see this being a font issue... does anyone
>
> I suggest completely wiping your .matplotlib directory (saving only
>
> your matplotlibrc if you have customized it).  matplotlib caches a
>
> Thanks, this fixed it!
> Though, futzing with the LaTeX settings in the new matplotlibrc it appears
> that something about how/when it chooses when to format as tex has changed.
>  If text.usetex is True, text in my labels and titles that is enclosed
> within $$'s gets typeset as tex, but apparently *all* of the xtick labels
> get set as mathtext - they're in the light/thin and slightly more difficult
> to read LaTeX font, and in my Basemap figures, the NSEW modifiers on the
> text objects indicating lat/lon direction are all italicised, as they would
> be were they enclosed in $$'s.  I don't seem to be able to get the
> relatively bold, sans-serif tick labels, while still preserving the ability
> to typeset math in my labels and titles...

We have two modes to render latex -- one is native TeX layout and uses
latex and dvipng, and is superior if you need all of TeX's
capabilities (eg an eqnarray), but the fonts are suboptimal.  The
other is mathtext, which will cover 98% of most users' math needs,
does not require a latex install because it is pure mpl, and uses
nicer fonts .  The docs are here:

  mathtext: http://matplotlib.sourceforge.net/users/mathtext.html
  usetex: http://matplotlib.sourceforge.net/users/usetex.html

I strongly encourage using mathtext over usetex, unless you need some
of the hairy stuff from TeX.

> (An aside: how does one go about decorating the Text objects that label the
> ticks?  I frequently have an axis whose units are degrees, and I'd rather
> just be able to append a $^\circ$ on the end of the text for the ticks,
> rather than have to say in the axis label [degrees].)

Use a custom formatter.  I'm freestyling here, so check the examples
linked to below

  import matplotlib.ticker as ticker
  formatter = ticker.FormatStrFormatter(r'$%1.2f^\circ$')
  ax.xaxis.set_major_formatter(formatter)

The API docs for the tick formatting and locating are here

  http://matplotlib.sourceforge.net/api/ticker_api.html

And code examples matching "formatter" are here

  http://matplotlib.sourceforge.net/search.html?q=codex+formatter

> If I set text.markup to 'tex', instead of 'plain' I get a complaint about it
> being invalid, with a pointer to a URL that no longer exists to obtain a new
> matplotlibrc:
> Bad key "text.markup" on line 162 in /Users/zane/.matplotlib/matplotlibrc.
> You probably need to get an updated matplotlibrc file
> from http://matplotlib.sf.net/matplotlibrc or from the matplotlib
> source distribution

I've updated the code in svn to point to the new location

  http://matplotlib.sourceforge.net/_static/matplotlibrc

See also http://matplotlib.sourceforge.net/users/customizing.html

JDH

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to