Re: [Matplotlib-users] Problems with, LaTeX symbols, axes rescaling

2008-11-24 Thread Eric Firing
Zane Selvans wrote:
 Yesterday I compiled Matplotlib from SVN, and installed it to run on top 
[...]
 
 The second thing is that in a figure in which I'm using twinx() to 
 create a separate y-axis using the same x-axis, I no longer seem to be 
 able to control the limits of the new axes.  They just automatically 
 re-scale to fit whatever data is being plotted, regardless of whether I 
 use ax.set_ylim().

Formerly, autoscaling was not supported by shared axes, which would have 
included twinx.  Now autoscaling is supported.  I suspect this is the 
difference you are seeing.  The solution is to turn off autoscaling with 
the ax.set_autoscale_on method, or to call ax.set_ylim after you have 
plotted your lines.

Eric

-
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=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with, LaTeX symbols, axes rescaling

2008-11-24 Thread John Hunter
On Mon, Nov 24, 2008 at 6:23 PM, Zane Selvans [EMAIL PROTECTED] wrote:

 whether it's just the fact that I'm using the SVN code.
 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
 know how/where Matplotlib gets pointed at the LaTeX fonts?  And how I would
 check to see where it's looking, or whether it's not finding what it's
 looking for?  I'm not getting any errors - my greek letters just cease to be
 greek, and various text decorations (like \bar{D}) come out as other things
 altogether (like D, only with an Angstrom symbol over it...).

I suggest completely wiping your .matplotlib directory (saving only
your matplotlibrc if you have customized it).  matplotlib caches a
fair amount of font and latex rendering stuff.  I had a similar
problem on an upgrade with mathtext.  We are not sure why it is
happening yet, but it will probably go away if you rm -rf
~/.matplotlib.  Also, wipe your site-packages/matplotlib dir before
installing.  See

  
http://matplotlib.sourceforge.net/faq/installing_faq.html#cleanly-rebuild-and-reinstall-everything

To get more verbose information about what mpl is doing behind the
scense, run with


python myscript.py --verbose-debug

You can use --verbose-helpful for less output.

I think it might be a good idea for us to start using a versioned dir
structure for the cached data...


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=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with, LaTeX symbols, axes rescaling

2008-11-24 Thread Zane Selvans


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...


(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].)


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


Thanks again!
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
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=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with, LaTeX symbols, axes rescaling

2008-11-24 Thread John Hunter
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=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users