Re: [Matplotlib-users] histogram examples?

2008-11-11 Thread Michael Hannon
On Tue, Nov 11, 2008 at 07:13:46AM -1000, Eric Firing wrote:
> Michael Hannon wrote:
> >Greetings.  I need to make some histograms from within a Python program,
> >and I noticed that Matplotlib, which I've never used before, appears to
> >have that capability.
> >
> >At:
> >http://matplotlib.sourceforge.net/
> >
> >I see the following  simple example:
> >
> >>>> from pylab import randn, hist
> >>>> x = randn(1)
> >>>> hist(x, 100)
> >
> >And there is a more-extended example at:
> >
> >http://matplotlib.sourceforge.net/_static/plot_directive/mpl_examples/pylab_examples/histogram_demo.py
> >
> >Unfortunately, when I run either example I get nothing but complaints
> >and errors, as in the appended.
> >
> >This is on a system running 64-bit Fedora 9 and Python 2.5.1.
> >
> >I'm evidently doing something wrong.  Will somebody please point  me in
> >the right direction?
> 
> 
> It sounds like your matplotlib version is too old for your numpy 
> version.  What version of matplotlib are you using?  Can you install a 
> newer one, or, better yet, build from svn?  (The warning from numpy is 
> easy to deal with; the TypeError from matplotlib is what indicates that 
> the version is incompatible.)
> 
> Eric

Hi, Eric.  I'm using the packages provided by Fedora:

numpy.x86_64 1.2.0-1.fc9
python-matplotlib.x86_64 0.91.4-1.fc9

It appears that numpy is reasonably up-to-date, but Matplotlib appears
to be relatively old (although I don't know what d(version)/dt is).

I'll look into installing from the source kits (and/or look into Fedora
10, which will be shipping in a couple of weeks, IIRC).

Thanks.

- Mike
-- 
Michael Hannonmailto:[EMAIL PROTECTED]
Dept. of Physics  530.752.4966
University of California  530.752.4717 FAX
Davis, CA 95616-8677

-
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


[Matplotlib-users] histogram examples?

2008-11-11 Thread Michael Hannon
Greetings.  I need to make some histograms from within a Python program,
and I noticed that Matplotlib, which I've never used before, appears to
have that capability.

At:
http://matplotlib.sourceforge.net/

I see the following  simple example:

>>> from pylab import randn, hist
>>> x = randn(1)
>>> hist(x, 100)

And there is a more-extended example at:

http://matplotlib.sourceforge.net/_static/plot_directive/mpl_examples/pylab_examples/histogram_demo.py

Unfortunately, when I run either example I get nothing but complaints
and errors, as in the appended.

This is on a system running 64-bit Fedora 9 and Python 2.5.1.

I'm evidently doing something wrong.  Will somebody please point  me in
the right direction?

Thanks.

- Mike


$ python
Python 2.5.1 (r251:54863, Jun 15 2008, 18:24:56) 
[GCC 4.3.0 20080428 (Red Hat 4.3.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylab import randn, hist
>>> x = randn(1)
>>> hist(x, 100)
/usr/lib64/python2.5/site-packages/numpy/lib/function_base.py:343:
Warning: 
The semantics of histogram has been modified in
the current release to fix long-standing issues with
outliers handling. The main changes concern
1. the definition of the bin edges,
   now including the rightmost edge, and
2. the handling of upper outliers, now ignored rather
   than tallied in the rightmost bin.
The previous behaviour is still accessible using
`new=False`, but is scheduled to be deprecated in the
next release (1.3).

*This warning will not printed in the 1.3 release.*

Use `new=True` to bypass this warning.

Please read the docstring for more information.

  """, Warning)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python2.5/site-packages/matplotlib/pyplot.py", line
1633, in hist
ret =  gca().hist(*args, **kwargs)
  File "/usr/lib64/python2.5/site-packages/matplotlib/axes.py", line
5117, in hist
n, bins = npy.histogram(x, bins, range=None, normed=normed)
TypeError: 'NoneType' object is not iterable


-- 
Michael Hannonmailto:[EMAIL PROTECTED]
Dept. of Physics  530.752.4966
University of California  530.752.4717 FAX
Davis, CA 95616-8677

-
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


Re: [Matplotlib-users] histogram examples?

2008-11-12 Thread Michael Hannon
On Tue, Nov 11, 2008 at 08:52:15AM -1000, Eric Firing wrote:
.
.
.
> >Hi, Eric.  I'm using the packages provided by Fedora:
> >
> >numpy.x86_64 1.2.0-1.fc9
> >python-matplotlib.x86_64 0.91.4-1.fc9
> >
> >It appears that numpy is reasonably up-to-date, but Matplotlib appears
> >to be relatively old (although I don't know what d(version)/dt is).
> 
> Yes, your numpy is fine, but your matplotlib is an older branch, and 
> although it is still being maintained it looks like it is not in sync 
> with changes to numpy going from 1.1 to 1.2.  I hope Fedora 10 has 
> switched to the current branch, 0.98.x.  In any case, however, 
> matplotlib changes fast enough that it may be worthwhile building your 
> own.  It is very easy to do on a linux machine once the necessary 
> headers are in place.  Typically this involves installing several *dev 
> or *devel packages--I don't know the specifics of Fedora packaging.

Thanks again, Eric.  I built Matplotlib 0.98 from source on my Fedora
box, and that did fix the problem.

I haven't checked Fedora 10 yet (arriving in 13 days).

- Mike
-- 
Michael Hannonmailto:[EMAIL PROTECTED]
Dept. of Physics  530.752.4966
University of California  530.752.4717 FAX
Davis, CA 95616-8677

-
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


[Matplotlib-users] Problem getting math symbols into text

2010-08-03 Thread Michael Hannon
Greetings.  I'm unable to get mathtext to work properly on my linux system:

# cat /etc/redhat-release 
Fedora release 13 (Goddard)

# uname -a
Linux localhost.localdomain 2.6.33.6-147.2.4.fc13.x86_64 #1 SMP Fri Jul 23
17:14:44 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

The problem is essentially identical to one that is described in the thread
at:

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg09208.html

I didn't see a real resolution to the problem in that thread, at least not one
that applied to me.

In brief, when I specify a math symbol in a text string, say:

r'$\pi$'

I get some "random" character (capital A in this case) at the place where I'm
supposed to see the Greek letter Pi.

Furthermore, if I try to coerce the use of the Greek letters by setting
"text.markup" to "tex", either interactively or in the rc file, I get an error
saying that it's not a valid parameter:

Bad key "text.markup" on line 161 in ... matplotlibrc

for instance.  This is followed by the message:

You probably need to get an updated matplotlibrc file from
http://matplotlib.sf.net/_static/matplotlibrc or from the matplotlib
source distribution

But the file at that link still contains:

#text.markup:'plain'  # Affects how text, such as titles and labels, are
  # interpreted by default.
  # 'plain': As plain, unformatted text
  # 'tex': As TeX-like text.  Text between $'s
  # will be
  # formatted as a TeX math expression.
  # This setting has no effect when text.usetex
  # is True.
  # In that case, all text will be sent to TeX
  # for
  # processing.

I don't know what to make of this.  I did the following to try to pin down the
parameters:

import matplotlib as mpl
import pprint
x = mpl.rcParams.keys()
x.sort()
pprint.pprint(x)

This produced:

.
.
.
'svg.image_noscale',
'text.color',
'text.dvipnghack',
'text.fontangle',
'text.fontsize',
'text.fontstyle',
'text.fontvariant',
'text.fontweight',
'text.latex.preamble',
'text.latex.preview',
'text.latex.unicode',
'text.usetex',
'timezone',
.
.
.

Indeed, there does not seem to be a "text.markup" in this list.

I have tried this both with and without an rc file, and I've tried it after
deleting completely my .matplotlib directory.  I get the same results in all
cases.

OTOH, if I set:

text.usetex

to "True", I do get the expected mathematical symbols, albeit after a noticeable
delay.

I've got the following two matplotlib packages installed:

python-matplotlib-0.99.1.2-4.fc13.x86_64
python-matplotlib-tk-0.99.1.2-4.fc13.x86_64

and the system is running Python 2.6.4.

Any suggestions?  Maybe I'm missing a package?

Thanks.

-- Mike


  

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem getting math symbols into text

2010-08-04 Thread Michael Hannon
> Wow, I hadn't realized that Fedora 13 is carrying a rather old version of
> matplotlib (~2 years old).  I should double-check what version is in rawhide
> and possibly prod some people to get them to choose a more recent version...
 
Hi, Ben.  I think it would be a good idea to give the Fedora people some
feedback on this.  I thought that one of the main points of Fedora was to
explore bleeding-edge software.

> I am not exactly sure what the cause of your problem is, but you could try
> uninstalling the Fedora packages of matplotlib and install the latest
> version from source.  Unless someone else has a better idea about what the
> cause of the problem is?

I'm usually reluctant to do this, as the packages installed from source don't
automatically get security updates, etc., but I tried your suggestion and
found the exercise painless.  And with the new version I DO get math symbols
on my plots.

Thanks for your help with this.

-- Mike


  --
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem getting math symbols into text

2010-08-09 Thread Michael Hannon




- Original Message 
> From: Michael Droettboom 
> To: Michael Hannon ; 
>matplotlib-users@lists.sourceforge.net
> Sent: Thu, August 5, 2010 6:24:58 AM
> Subject: Re: [Matplotlib-users] Problem getting math symbols into text

> It looks like you're configured for the STIX fonts (the rcParam
> mathtext.fontset = stix), but they are not installed on your system.
> 
> Do you have the file "STIXGeneral.ttf" on your system?  Perhaps you need to
> install an additional package.

Hi, Mike.  I've thrashed around a bit more with this.  It appears that if I
use the matplotlib from Fedora 13 (version 0.99) I get the correct behavior
for math text if I also install the stix* packages AND set
rcParams[mathtext.fontset] to "stix".  (There are four stix packages in Fedora
13, all small, and I just installed all of them, so I don't know what the
minimum requirement is).

I also got the appropriate math text when I installed the latest matplotlib
from source and used all the default settings.  I've now reverted to the
standard Fedora packages and stix, so I can't easily compare the two sets of
rcParams.

Thanks for your help.

-- Mike


  

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users