Re: [Matplotlib-users] How Does One Learn to Use MatPlotLib?

2010-02-09 Thread Gökhan Sever
On Tue, Feb 9, 2010 at 8:15 PM, Wayne Watson
wrote:

> Subject is the question.
>
> As I see it, it's useful to know MatLab. A simple query with matplotlib
> tutorial shows a number of hits. The first, reference to v0.99.a
> documentation barely qualifies. Examples galore and a pretty minimal
> introduction. In the first 10 or so hits ther's a blog and mention of a
> video. The blog may appeal to some, but it seems unelementary. The video
> basically asks to sign in. Who knows where that goes? I've seen a few
> videos for MPL, but they all look tied into $$.
>
> I've made some reasonable progress on MPL, but am still far short of
> being confident of using it.  Too much try this and see.
>
> I know of exactly one book on MPL ( for scientists. sounds interesting).
> It was published recently by a foreign author. It is not yet widely
> distributed.
>
> Your turn. Comments?
> --
> "Crime is way down. War is declining. And that's far from the good
> news." -- Steven Pinker (and other sources) Why is this true, but yet
> the media says otherwise? The media knows very well how to manipulate us
> (see limbic, emotion, $$). -- WTW
>
>
> --
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

For me best way to learn is to use it actually :) Especially on homework and
projects. Mailing lists are also very helpful as you are already doing.

Try with ipython --pylab option.

Also check SciPy09 (http://conference.scipy.org/SciPy2009/) videos. There
are one introductory and advanced tutorials that you can see online (without
registering) or downloading to your computer.



-- 
Gökhan
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Christoph Gohlke
To close this thread: the PyEval_RestoreThread crash is a known bug in
the tkagg backend on Windows. See line 375 of backend_tkagg.py:

def show(self):
"""
this function doesn't segfault but causes the
PyEval_RestoreThread: NULL state bug on win32
"""

-- Christoph

On 2/9/2010 10:26 AM, Christoph Gohlke wrote:
> Change the last line to pylab.show() and it should work.
> 
> Anyway, this example should not crash the interpreter. I can reproduce
> the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with
> mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0.
> 
> The shortest example that crashes is:
> 
> python -c "import pylab;pylab.subplot(111).figure.show()"
> 
> or on the interactive prompt:
> 
 import pylab
 pylab.subplot(111).figure.show()
 exit()
> Fatal Python error: PyEval_RestoreThread: NULL tstate
> 
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> 
> 
> -- Christoph
> 
> On 2/9/2010 7:57 AM, Lee Boger wrote:
>> > 
>> > Windows XP Professional with Python 2.5 installed (pywin32 build 210) -
>> > came with dSPACE software package
>> > 
>> > Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>> > sourceforge.net
>> > 
>> > Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from
>> > sourceforge.net
>> > 
>> > Executing the following simple "log plot" script within PythonWin:
>> > 
>> > *from* matplotlib *import* pylab
>> > 
>> > # Create some artificial data.
>> > test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>> > 17, 18, 19, 20]
>> > test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5,
>> > -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>> > spec_frequency = [6, 8]
>> > spec_results = [-3.0, -3.0]
>> > 
>> > # Plot
>> > figure = pylab.subplot(111)
>> > figure.semilogx()
>> > figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>> > edgecolors='none')
>> > figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>> > edgecolors='none')
>> > figure.grid(True)
>> > figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>> > figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>> > 
>> > figure.figure.savefig('log_plot')
>> > figure.figure.show()
>> > 
>> > 
>> > Plots a figure on the screen that looks correct, then the following
>> > error (when I click OK, PythonWin closes)
>> > 
>> > 
>> > 
>> > Any advice would be appreciated. Maybe it's an installation or setup
>> > issue, but I'm pretty knew to Python programming and don't know how to
>> > debug this.
>> > 
>> > Lee Boger

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How Does One Learn to Use MatPlotLib?

2010-02-09 Thread C M
 wrote:
> Subject is the question.
>
> As I see it, it's useful to know MatLab. A simple query with matplotlib
> tutorial shows a number of hits. The first, reference to v0.99.a
> documentation barely qualifies. Examples galore and a pretty minimal
> introduction. In the first 10 or so hits ther's a blog and mention of a
> video. The blog may appeal to some, but it seems unelementary. The video
> basically asks to sign in. Who knows where that goes? I've seen a few
> videos for MPL, but they all look tied into $$.
>
> I've made some reasonable progress on MPL, but am still far short of
> being confident of using it.  Too much try this and see.
>
> I know of exactly one book on MPL ( for scientists. sounds interesting).
> It was published recently by a foreign author. It is not yet widely
> distributed.
>
> Your turn. Comments?

Have you read the manual itself?  I found that quite helpful in getting started:

http://matplotlib.sourceforge.net/users/index.html

I've been satisfied with learning a bit here and there as I go.  It's
a big project, and I don't expect to understand it all at once.  But,
that said, even with a partial understanding I'm pleased at what it
can do for my needs.  What I find is first you should determine what
is the desired outcome you want, then Google around for mentions of
this in old threads or on the matplotlib site, then maybe try asking
for assistance on the list.

Che

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How Does One Learn to Use MatPlotLib?

2010-02-09 Thread Wayne Watson
Subject is the question.

As I see it, it's useful to know MatLab. A simple query with matplotlib 
tutorial shows a number of hits. The first, reference to v0.99.a 
documentation barely qualifies. Examples galore and a pretty minimal 
introduction. In the first 10 or so hits ther's a blog and mention of a 
video. The blog may appeal to some, but it seems unelementary. The video 
basically asks to sign in. Who knows where that goes? I've seen a few 
videos for MPL, but they all look tied into $$.

I've made some reasonable progress on MPL, but am still far short of 
being confident of using it.  Too much try this and see.

I know of exactly one book on MPL ( for scientists. sounds interesting). 
It was published recently by a foreign author. It is not yet widely 
distributed.

Your turn. Comments?
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Sankey diagram

2010-02-09 Thread Yannick Copin

Hi List,

I made a script to draw very simple (single-direction single-input 
single-sided single-everything) Sankey diagrams (attached). I think I 
could share, if it can be of any use...


Cheers,

Yannick
#!/usr/bin/env python
# Time-stamp: <2010-02-10 01:49:08 ycopin>

import numpy as N
import matplotlib.pyplot as P
import matplotlib.patches as mpatches
from matplotlib.path import Path

def sankey(ax, losses, labels=None,
   dx=40, dy=10, angle=45, w=3, dip=10, offset=2, **kwargs):
"""Draw a Sankey diagram.

losses: array of losses, should sum up to 100%
labels: loss labels (same length as losses),
or None (use default labels) or '' (no labels)
dx: horizontal elongation
dy: vertical elongation
angle: arrow angle [deg]
w: arrow shoulder
dip: input dip
offset: text offset
**kwargs: propagated to Patch (e.g. fill=False)

Return (patch,texts)."""

assert sum(losses)==100, "Input losses don't sum up to 100%"

def add_loss(loss, last=False):
h = (loss/2+w)*N.tan(angle/180.*N.pi) # Arrow tip height
move,(x,y) = path[-1]   # Use last point as reference
if last:# Final loss (horizontal)
path.extend([(Path.LINETO,[x+dx,y]),
 (Path.LINETO,[x+dx,y+w]),
 (Path.LINETO,[x+dx+h,y-loss/2]), # Tip
 (Path.LINETO,[x+dx,y-loss-w]),
 (Path.LINETO,[x+dx,y-loss])])
tips.append(path[-3][1])
else:   # Intermediate loss (vertical)
path.extend([(Path.LINETO,[x+dx/2,y]),
(Path.CURVE3,[x+dx,y]),
(Path.CURVE3,[x+dx,y+dy]),
(Path.LINETO,[x+dx-w,y+dy]),
(Path.LINETO,[x+dx+loss/2,y+dy+h]), # Tip
(Path.LINETO,[x+dx+loss+w,y+dy]),
(Path.LINETO,[x+dx+loss,y+dy]),
(Path.CURVE3,[x+dx+loss,y-loss]),
(Path.CURVE3,[x+dx/2+loss,y-loss])])
tips.append(path[-5][1])

tips = []   # Arrow tip positions
path = [(Path.MOVETO,[0,100])]  # 1st point
for i,loss in enumerate(losses):
add_loss(loss, last=(i==(len(losses)-1)))
path.extend([(Path.LINETO,[0,0]),
 (Path.LINETO,[dip,50]), # Dip
 (Path.CLOSEPOLY,[0,100])])
codes,verts = zip(*path)
verts = N.array(verts)

# Path patch
path = Path(verts,codes)
patch = mpatches.PathPatch(path, **kwargs)
ax.add_patch(patch)

# Labels
if labels=='':  # No labels
pass
elif labels is None:# Default labels
labels = [ '%2d%%' % loss for loss in losses ]
else:
assert len(labels)==len(losses)

texts = []
for i,label in enumerate(labels):
x,y = tips[i]   # Label position
last = (i==(len(losses)-1))
if last:
t = ax.text(x+offset,y,label, ha='left', va='center')
else:
t = ax.text(x,y+offset,label, ha='center', va='bottom')
texts.append(t)

# Axes management
ax.set_xlim(verts[:,0].min()-10, verts[:,0].max()+40)
ax.set_ylim(verts[:,1].min()-10, verts[:,1].max()+20)
ax.set_aspect('equal', adjustable='datalim')
ax.set_xticks([])
ax.set_yticks([])

return patch,texts

if __name__=='__main__':

losses = [10.,20.,5.,15.,10.,40.]
labels = ['First','Second','Third','Fourth','Fifth','Hurray!']
labels = [ s+'\n%d%%' % l for l,s in zip(losses,labels) ]

fig = P.figure()
ax = fig.add_subplot(1,1,1)

patch,texts = sankey(ax, losses, labels, fc='g', alpha=0.2)
texts[1].set_color('r')
texts[-1].set_fontweight('bold')

P.show()
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hatching problem

2010-02-09 Thread Michiel de Hoon
I wasn't able to replicate this problem with the Mac OS X backend with 
matplotlib 0.99.1.1. Both the on-screen figure and the ps output look fine.

--Michiel.


--- On Tue, 2/9/10, Jae-Joon Lee  wrote:

> From: Jae-Joon Lee 
> Subject: Re: [Matplotlib-users] hatching problem
> To: "Tomasz Koziara" 
> Cc: matplotlib-users@lists.sourceforge.net
> Date: Tuesday, February 9, 2010, 10:42 AM
> I cannot reproduce it with Agg
> backend and ps backend. I tried both
> svn version and 0.99 maint. version.
> So, maybe this is a bug in mac os X backend?
> Do you see a same problem with the ps output? If so, can
> you post your
> ouput ps file?
> 
> Regards,
> 
> -JJ
> 
> 
> On Mon, Feb 8, 2010 at 3:26 PM, Tomasz Koziara
> 
> wrote:
> > Dear Users/Developers
> >
> > I just installed version 0.99.1.1 since in my previous
> version (0.98) I had
> > problems with hatching. It seems though that the same
> problems persist in
> > the current version. The attached files reproduce the
> problem (a data file
> > and a python short script). Note that hatching is not
> present on all green
> > 'CONUPD' fields - but only on few of them.
> >
> > I will appreciate some hints on how to get by,
> > Regards
> > Tomek
> >
> > ===
> >
> >
> >
> >
> >
> >
> > ===
> >
> > dh178-192:tkp5 tomek$ python plots.py
> --verbose-helpful
> > $HOME=/Users/tomek
> > CONFIGDIR=/Users/tomek/.matplotlib
> > matplotlib data path
> /Library/Python/2.5/site-packages/matplotlib/mpl-data
> > loaded rc file
> >
> /Library/Python/2.5/site-packages/matplotlib/mpl-data/matplotlibrc
> > matplotlib version 0.99.1.1
> > verbose.level helpful
> > interactive is False
> > units is False
> > platform is darwin
> > Using fontManager instance from
> /Users/tomek/.matplotlib/fontList.cache
> > backend MacOSX version unknown
> > findfont: Matching
> >
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> > to Bitstream Vera Sans
> >
> (/Library/Python/2.5/site-packages/matplotlib-0.98.6svn-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> > with score of 0.00
> > findfont: Matching
> >
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=large
> > to Bitstream Vera Sans
> >
> (/Library/Python/2.5/site-packages/matplotlib-0.98.6svn-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> > with score of 0.00
> >
> >
> >
> --
> > The Planet: dedicated and managed hosting, cloud
> storage, colocation
> > Stay online with enterprise data centers and the best
> network in the
> > business
> > Choose flexible plans and management services without
> long-term contracts
> > Personal 24x7 support from experience hosting pros
> just a phone call away.
> > http://p.sf.net/sfu/theplanet-com
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
> 
> --
> The Planet: dedicated and managed hosting, cloud storage,
> colocation
> Stay online with enterprise data centers and the best
> network in the business
> Choose flexible plans and management services without
> long-term contracts
> Personal 24x7 support from experience hosting pros just a
> phone call away.
> http://p.sf.net/sfu/theplanet-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 


  

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Christoph Gohlke
I can now reproduce this. It seems the same old problem that PythonWin
can not reliably run matplotlib because successive runs of the script
use the same interpreter. Ipython should work. Append pylab.close() to
your script; at least it will not crash on the second run.

-- Christoph

On 2/9/2010 10:44 AM, Lee Boger wrote:
> 
> Although, if I close the figure then re-run the script, a new figure
> pops up but it doesn't have any data plotted. Interpreter is now locked
> up. I'm still not fixing it completely. There is also no figure stored
> as a file log_plot.
> 
> Lee
> 
> 
> *Christoph Gohlke *
> 
> 02/09/2010 01:23 PM
> 
>   
> To
>   Lee Boger 
> cc
>   
> Subject
>   Re: [Matplotlib-users] Runtime Error - Need Advice
> 
> 
>   
> 
> 
> Caterpillar: Confidential GreenRetain Until: 03/11/2010
> 
> 
> 
> 
> Change the last line to pylab.show() and it should work.
> 
> Anyway, this example should not crash the interpreter. I can reproduce
> the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with
> mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0.
> 
> The shortest example that crashes is:
> 
> python -c "import pylab;pylab.subplot(111).figure.show()"
> 
> or on the interactive prompt:
> 
 import pylab
 pylab.subplot(111).figure.show()
 exit()
> Fatal Python error: PyEval_RestoreThread: NULL tstate
> 
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> 
> 
> -- Christoph
> 
> On 2/9/2010 7:57 AM, Lee Boger wrote:
>>
>> Windows XP Professional with Python 2.5 installed (pywin32 build 210) -
>> came with dSPACE software package
>>
>> Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>> sourceforge.net
>>
>> Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from
>> sourceforge.net
>>
>> Executing the following simple "log plot" script within PythonWin:
>>
>> *from* matplotlib *import* pylab
>>
>> # Create some artificial data.
>> test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>> 17, 18, 19, 20]
>> test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5,
>> -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>> spec_frequency = [6, 8]
>> spec_results = [-3.0, -3.0]
>>
>> # Plot
>> figure = pylab.subplot(111)
>> figure.semilogx()
>> figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>> edgecolors='none')
>> figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>> edgecolors='none')
>> figure.grid(True)
>> figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>> figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>>
>> figure.figure.savefig('log_plot')
>> figure.figure.show()
>>
>>
>> Plots a figure on the screen that looks correct, then the following
>> error (when I click OK, PythonWin closes)
>>
>>
>>
>> Any advice would be appreciated. Maybe it's an installation or setup
>> issue, but I'm pretty knew to Python programming and don't know how to
>> debug this.
>>
>> Lee Boger
>>
>>
>>
>> --
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the
> business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>>
>>
>>
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Surface Plot

2010-02-09 Thread Ted Kord
Paul

The example works fine and was quite instructive. Thx.

Ted



On 8 February 2010 21:41,  wrote:

>  Ted,
>
>
>
> How does this example run for you?
>
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/griddata_demo.html
>
>
>
> *From:* Ted Kord [mailto:teddy.k...@googlemail.com]
> *Sent:* Monday, February 08, 2010 12:00 PM
> *To:* Paul Hobson
> *Cc:* matplotlib-users@lists.sourceforge.net
> *Subject:* Re: [Matplotlib-users] Surface Plot
>
>
>
> On 8 February 2010 17:37,  wrote:
>
> Hey Ted,
>
> I don't quite understand how you're getting the Z data below. But if you
> have 3D data in X, Y, and Z 1D-arrays, the griddata function should work for
> you.
>
> http://matplotlib.sourceforge.net/api/mlab_api.html#matplotlib.mlab.griddata
>
> HTH,
> -paul
>
>
>
> Hi  Paul
>
>
>
> Is there a way to colour the output? For some reason, the final output is
> in a single colour even though I've specified cm.jet for the colour map.
>
>
>
> Regards
>
>
>
> Ted
>
>
>
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Lee Boger
Python version 2.5.1, Tk version 8.4, IDLE version 1.2.1

Lee



Christoph Gohlke  
02/09/2010 03:08 PM

To
matplotlib-users 
cc

Subject
Re: [Matplotlib-users] Runtime Error - Need Advice




Caterpillar: Confidential Green Retain Until: 03/11/2010 



I am not sure what's going on. The script you posted imports pylab in
the first line. It should be defined. The scrit works just fine after
the proposed changes, even from Pythonwin. Did you completely quit
Pythonwin after the crashes and made sure no corrupted python instance
was left running? Please send the version string of your python
installation.

Christoph

On 2/9/2010 11:10 AM, Lee Boger wrote:
> 
> Per another suggestion, I did uninstall numpy 1.4 and installed numpy
> 1.3, but got the same results. Using pylab.savefig('log_plot) resulted
> in the following error:
> 
> Traceback (most recent call last):
>   File "C:\Program Files\Common
> 
Files\dSPACE\Python25\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
> line 310, in RunScript
> exec codeObject in __main__.__dict__
>   File "C:\Documents and Settings\BogerLC\My Documents\Script2.py", line
> 20, in 
> pylab.savefig('log_plot')
> NameError: name 'pylab' is not defined
> 
> Using pyplot.savefig('log_plot') does not have an error, but I still get
> no file saved. Maybe it is a "backend" thing, which I know nothing
> about. I'll look into it. Thanks.
> 
> Lee
> 
> 
> *Christoph Gohlke *
> 
> 02/09/2010 02:03 PM
> 
> 
> To
>matplotlib-users 
> cc
> 
> Subject
>Re: [Matplotlib-users] Runtime Error - Need Advice
> 
> 
> 
> 
> 
> Caterpillar: Confidential GreenRetain Until: 03/11/2010 
> 
> 
> 
> 
> Use pylab.savefig('log_plot'). Also saving the figure to file and
> showing it interactively in the same script might involve switching
> backends, which might not work as expected.
> 
> It is advisable to downgrade to numpy 1.3.
> 
> -- Christoph
> 
> On 2/9/2010 10:44 AM, Lee Boger wrote:
>>
>> Although, if I close the figure then re-run the script, a new figure
>> pops up but it doesn't have any data plotted. Interpreter is now locked
>> up. I'm still not fixing it completely. There is also no figure stored
>> as a file log_plot.
>>
>> Lee
>>
>>
>> *Christoph Gohlke *
>>
>> 02/09/2010 01:23 PM
>>
>> 
>> To
>>  Lee Boger 
>> cc
>> 
>> Subject
>>  Re: [Matplotlib-users] Runtime Error - Need Advice
>>
>>
>> 
>>
>>
>> Caterpillar: Confidential GreenRetain Until: 03/11/2010 
>>
>>
>>
>>
>> Change the last line to pylab.show() and it should work.
>>
>> Anyway, this example should not crash the interpreter. I can reproduce
>> the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with
>> mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0.
>>
>> The shortest example that crashes is:
>>
>> python -c "import pylab;pylab.subplot(111).figure.show()"
>>
>> or on the interactive prompt:
>>
> import pylab
> pylab.subplot(111).figure.show()
> exit()
>> Fatal Python error: PyEval_RestoreThread: NULL tstate
>>
>> This application has requested the Runtime to terminate it in an 
unusual
>> way.
>> Please contact the application's support team for more information.
>>
>>
>> -- Christoph
>>
>> On 2/9/2010 7:57 AM, Lee Boger wrote:
>>>
>>> Windows XP Professional with Python 2.5 installed (pywin32 build 210) 
-
>>> came with dSPACE software package
>>>
>>> Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>>> sourceforge.net
>>>
>>> Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe 
from
>>> sourceforge.net
>>>
>>> Executing the following simple "log plot" script within PythonWin:
>>>
>>> *from* matplotlib *import* pylab
>>>
>>> # Create some artificial data.
>>> test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16,
>>> 17, 18, 19, 20]
>>> test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, 
-5,
>>> -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>>> spec_frequency = [6, 8]
>>> spec_results = [-3.0, -3.0]
>>>
>>> # Plot
>>> figure = pylab.subplot(111)
>>> figure.semilogx()
>>> figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>>> edgecolors='none')
>>> figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>>> edgecolors='none')
>>> figure.grid(True)
>>> figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>>> figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>>>
>>> figure.figure.savefig('log_plot')
>>> figure.figure.show()
>>>
>>>
>>> Plots a figure on the screen that looks correct, then the following
>>> error (when I click OK, PythonWin closes)
>>>
>>>
>>>
>>> Any advice would be appreciated. Maybe it's an installation or setup
>>> issue, but I'm pretty knew to Python programming and don't know how to
>>> debug this.
>>>
>>> Lee Boger
>>>
>>>
>>>
>>>
> 
--
>>> The Planet: dedicated and managed hosting, cloud storage, 

Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Lee Boger
I tried something that seems to work consistently - I get the correct plot 
figure and the correct log_plot.png file created everytime I run the 
script.

>From the Start menu, I chose All Programs-Python2.5-IDLE (Python GUI) 
instead of All Programs-Python2.5-PythonWin, which creates the Tk Python 
Shell. I then open the script file and run it. I think you were right. 
Does this make sense?

Lee

__

Thanks for your help. I'll look into ipython.

Lee



Eric Firing  
02/09/2010 02:31 PM

To
Lee Boger , matplotlib-users 

cc

Subject
Re: [Matplotlib-users] Runtime Error - Need Advice




Caterpillar: Confidential Green Retain Until: 03/11/2010 



Lee Boger wrote:
> 
> Thanks for the quick feedback. I changed the last line from 
> figure.figure.show() to pyplot.show() and it worked without crashing the 

> interpreter. However, if I close the figure then re-run the script, a 
> new figure pops up but it doesn't have any data plotted. Interpreter is 
> now locked up, the run-time error occurred and no figure stored as a 
> file log_plot. I un-installed numpy-1.4.0 and installed numpy-1.3.0, but 

> the results were as I just described.
> 
> Lee
> 


At this point a Windows user may need to step in.  I know nothing about 
PythonWin.  My suspicion is that this is a problem of dueling event 
loops, and one solution would be to use ipython instead of pythonwin.

(Note that you typically need to use "reply to all" on this list, 
otherwise the reply does not get copied to the list.)

Eric

> 
> 
> *Eric Firing *
> 
> 02/09/2010 01:35 PM
> 
> 
> To
>Lee Boger 
> cc
>matplotlib-users@lists.sourceforge.net
> Subject
>Re: [Matplotlib-users] Runtime Error - Need Advice
> 
> 
> 
> 
> 
> Caterpillar: Confidential GreenRetain Until: 03/11/2010 
> 
> 
> 
> 
> Lee Boger wrote:
>  >
>  > Windows XP Professional with Python 2.5 installed (pywin32 build 210) 
-
>  > came with dSPACE software package
>  >
>  > Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>  > sourceforge.net
>  >
>  > Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe 
from
>  > sourceforge.net
> 
> I suspect this is the problem: numpy-1.4.0 is considered broken and has
> been withdrawn.  Specifically, it introduces binary incompatibility with
> programs compiled against prior versions of numpy, including matplotlib.
> If you go back to the numpy sourceforge site now, I think you will see
> an earlier version that you can install in place of 1.4.0 (after
> removing the latter).
> 
> Eric
> 
>  >
>  > Executing the following simple "log plot" script within PythonWin:
>  >
>  > *from* matplotlib *import* pylab
>  >
>  > # Create some artificial data.
>  > test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16,
>  > 17, 18, 19, 20]
>  > test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, 
-5,
>  > -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>  > spec_frequency = [6, 8]
>  > spec_results = [-3.0, -3.0]
>  >
>  > # Plot
>  > figure = pylab.subplot(111)
>  > figure.semilogx()
>  > figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>  > edgecolors='none')
>  > figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>  > edgecolors='none')
>  > figure.grid(True)
>  > figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>  > figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>  >
>  > figure.figure.savefig('log_plot')
>  > figure.figure.show()
>  >
>  >
>  > Plots a figure on the screen that looks correct, then the following
>  > error (when I click OK, PythonWin closes)
>  >
>  >
>  >
>  > Any advice would be appreciated. Maybe it's an installation or setup
>  > issue, but I'm pretty knew to Python programming and don't know how 
to
>  > debug this.
>  >
>  > Lee Boger
> 


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Christoph Gohlke
I am not sure what's going on. The script you posted imports pylab in
the first line. It should be defined. The scrit works just fine after
the proposed changes, even from Pythonwin. Did you completely quit
Pythonwin after the crashes and made sure no corrupted python instance
was left running? Please send the version string of your python
installation.

Christoph

On 2/9/2010 11:10 AM, Lee Boger wrote:
> 
> Per another suggestion, I did uninstall numpy 1.4 and installed numpy
> 1.3, but got the same results. Using pylab.savefig('log_plot) resulted
> in the following error:
> 
> Traceback (most recent call last):
>   File "C:\Program Files\Common
> Files\dSPACE\Python25\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
> line 310, in RunScript
> exec codeObject in __main__.__dict__
>   File "C:\Documents and Settings\BogerLC\My Documents\Script2.py", line
> 20, in 
> pylab.savefig('log_plot')
> NameError: name 'pylab' is not defined
> 
> Using pyplot.savefig('log_plot') does not have an error, but I still get
> no file saved. Maybe it is a "backend" thing, which I know nothing
> about. I'll look into it. Thanks.
> 
> Lee
> 
> 
> *Christoph Gohlke *
> 
> 02/09/2010 02:03 PM
> 
>   
> To
>   matplotlib-users 
> cc
>   
> Subject
>   Re: [Matplotlib-users] Runtime Error - Need Advice
> 
> 
>   
> 
> 
> Caterpillar: Confidential GreenRetain Until: 03/11/2010
> 
> 
> 
> 
> Use pylab.savefig('log_plot'). Also saving the figure to file and
> showing it interactively in the same script might involve switching
> backends, which might not work as expected.
> 
> It is advisable to downgrade to numpy 1.3.
> 
> -- Christoph
> 
> On 2/9/2010 10:44 AM, Lee Boger wrote:
>>
>> Although, if I close the figure then re-run the script, a new figure
>> pops up but it doesn't have any data plotted. Interpreter is now locked
>> up. I'm still not fixing it completely. There is also no figure stored
>> as a file log_plot.
>>
>> Lee
>>
>>
>> *Christoph Gohlke *
>>
>> 02/09/2010 01:23 PM
>>
>>  
>> To
>>  Lee Boger 
>> cc
>>  
>> Subject
>>  Re: [Matplotlib-users] Runtime Error - Need Advice
>>
>>
>>  
>>
>>
>> Caterpillar: Confidential GreenRetain Until: 03/11/2010
>>
>>
>>
>>
>> Change the last line to pylab.show() and it should work.
>>
>> Anyway, this example should not crash the interpreter. I can reproduce
>> the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with
>> mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0.
>>
>> The shortest example that crashes is:
>>
>> python -c "import pylab;pylab.subplot(111).figure.show()"
>>
>> or on the interactive prompt:
>>
> import pylab
> pylab.subplot(111).figure.show()
> exit()
>> Fatal Python error: PyEval_RestoreThread: NULL tstate
>>
>> This application has requested the Runtime to terminate it in an unusual
>> way.
>> Please contact the application's support team for more information.
>>
>>
>> -- Christoph
>>
>> On 2/9/2010 7:57 AM, Lee Boger wrote:
>>>
>>> Windows XP Professional with Python 2.5 installed (pywin32 build 210) -
>>> came with dSPACE software package
>>>
>>> Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>>> sourceforge.net
>>>
>>> Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from
>>> sourceforge.net
>>>
>>> Executing the following simple "log plot" script within PythonWin:
>>>
>>> *from* matplotlib *import* pylab
>>>
>>> # Create some artificial data.
>>> test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>>> 17, 18, 19, 20]
>>> test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5,
>>> -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>>> spec_frequency = [6, 8]
>>> spec_results = [-3.0, -3.0]
>>>
>>> # Plot
>>> figure = pylab.subplot(111)
>>> figure.semilogx()
>>> figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>>> edgecolors='none')
>>> figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>>> edgecolors='none')
>>> figure.grid(True)
>>> figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>>> figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>>>
>>> figure.figure.savefig('log_plot')
>>> figure.figure.show()
>>>
>>>
>>> Plots a figure on the screen that looks correct, then the following
>>> error (when I click OK, PythonWin closes)
>>>
>>>
>>>
>>> Any advice would be appreciated. Maybe it's an installation or setup
>>> issue, but I'm pretty knew to Python programming and don't know how to
>>> debug this.
>>>
>>> Lee Boger
>>>
>>>
>>>
>>>
> --
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the
>> business
>>> Choose flexible plans and management services without long-term contracts
>>> Personal 24x7 supp

Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Lee Boger
Thanks for your help. I'll look into ipython.

Lee



Eric Firing  
02/09/2010 02:31 PM

To
Lee Boger , matplotlib-users 

cc

Subject
Re: [Matplotlib-users] Runtime Error - Need Advice




Caterpillar: Confidential Green Retain Until: 03/11/2010 



Lee Boger wrote:
> 
> Thanks for the quick feedback. I changed the last line from 
> figure.figure.show() to pyplot.show() and it worked without crashing the 

> interpreter. However, if I close the figure then re-run the script, a 
> new figure pops up but it doesn't have any data plotted. Interpreter is 
> now locked up, the run-time error occurred and no figure stored as a 
> file log_plot. I un-installed numpy-1.4.0 and installed numpy-1.3.0, but 

> the results were as I just described.
> 
> Lee
> 


At this point a Windows user may need to step in.  I know nothing about 
PythonWin.  My suspicion is that this is a problem of dueling event 
loops, and one solution would be to use ipython instead of pythonwin.

(Note that you typically need to use "reply to all" on this list, 
otherwise the reply does not get copied to the list.)

Eric

> 
> 
> *Eric Firing *
> 
> 02/09/2010 01:35 PM
> 
> 
> To
>Lee Boger 
> cc
>matplotlib-users@lists.sourceforge.net
> Subject
>Re: [Matplotlib-users] Runtime Error - Need Advice
> 
> 
> 
> 
> 
> Caterpillar: Confidential GreenRetain Until: 03/11/2010 
> 
> 
> 
> 
> Lee Boger wrote:
>  >
>  > Windows XP Professional with Python 2.5 installed (pywin32 build 210) 
-
>  > came with dSPACE software package
>  >
>  > Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>  > sourceforge.net
>  >
>  > Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe 
from
>  > sourceforge.net
> 
> I suspect this is the problem: numpy-1.4.0 is considered broken and has
> been withdrawn.  Specifically, it introduces binary incompatibility with
> programs compiled against prior versions of numpy, including matplotlib.
> If you go back to the numpy sourceforge site now, I think you will see
> an earlier version that you can install in place of 1.4.0 (after
> removing the latter).
> 
> Eric
> 
>  >
>  > Executing the following simple "log plot" script within PythonWin:
>  >
>  > *from* matplotlib *import* pylab
>  >
>  > # Create some artificial data.
>  > test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16,
>  > 17, 18, 19, 20]
>  > test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, 
-5,
>  > -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>  > spec_frequency = [6, 8]
>  > spec_results = [-3.0, -3.0]
>  >
>  > # Plot
>  > figure = pylab.subplot(111)
>  > figure.semilogx()
>  > figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>  > edgecolors='none')
>  > figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>  > edgecolors='none')
>  > figure.grid(True)
>  > figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>  > figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>  >
>  > figure.figure.savefig('log_plot')
>  > figure.figure.show()
>  >
>  >
>  > Plots a figure on the screen that looks correct, then the following
>  > error (when I click OK, PythonWin closes)
>  >
>  >
>  >
>  > Any advice would be appreciated. Maybe it's an installation or setup
>  > issue, but I'm pretty knew to Python programming and don't know how 
to
>  > debug this.
>  >
>  > Lee Boger
> 


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Eric Firing
Lee Boger wrote:
> 
> Thanks for the quick feedback. I changed the last line from 
> figure.figure.show() to pyplot.show() and it worked without crashing the 
> interpreter. However, if I close the figure then re-run the script, a 
> new figure pops up but it doesn't have any data plotted. Interpreter is 
> now locked up, the run-time error occurred and no figure stored as a 
> file log_plot. I un-installed numpy-1.4.0 and installed numpy-1.3.0, but 
> the results were as I just described.
> 
> Lee
> 


At this point a Windows user may need to step in.  I know nothing about 
PythonWin.  My suspicion is that this is a problem of dueling event 
loops, and one solution would be to use ipython instead of pythonwin.

(Note that you typically need to use "reply to all" on this list, 
otherwise the reply does not get copied to the list.)

Eric

> 
> 
> *Eric Firing *
> 
> 02/09/2010 01:35 PM
> 
>   
> To
>   Lee Boger 
> cc
>   matplotlib-users@lists.sourceforge.net
> Subject
>   Re: [Matplotlib-users] Runtime Error - Need Advice
> 
> 
>   
> 
> 
> Caterpillar: Confidential GreenRetain Until: 03/11/2010
> 
> 
> 
> 
> Lee Boger wrote:
>  >
>  > Windows XP Professional with Python 2.5 installed (pywin32 build 210) -
>  > came with dSPACE software package
>  >
>  > Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>  > sourceforge.net
>  >
>  > Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from
>  > sourceforge.net
> 
> I suspect this is the problem: numpy-1.4.0 is considered broken and has
> been withdrawn.  Specifically, it introduces binary incompatibility with
> programs compiled against prior versions of numpy, including matplotlib.
> If you go back to the numpy sourceforge site now, I think you will see
> an earlier version that you can install in place of 1.4.0 (after
> removing the latter).
> 
> Eric
> 
>  >
>  > Executing the following simple "log plot" script within PythonWin:
>  >
>  > *from* matplotlib *import* pylab
>  >
>  > # Create some artificial data.
>  > test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>  > 17, 18, 19, 20]
>  > test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5,
>  > -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>  > spec_frequency = [6, 8]
>  > spec_results = [-3.0, -3.0]
>  >
>  > # Plot
>  > figure = pylab.subplot(111)
>  > figure.semilogx()
>  > figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>  > edgecolors='none')
>  > figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>  > edgecolors='none')
>  > figure.grid(True)
>  > figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>  > figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>  >
>  > figure.figure.savefig('log_plot')
>  > figure.figure.show()
>  >
>  >
>  > Plots a figure on the screen that looks correct, then the following
>  > error (when I click OK, PythonWin closes)
>  >
>  >
>  >
>  > Any advice would be appreciated. Maybe it's an installation or setup
>  > issue, but I'm pretty knew to Python programming and don't know how to
>  > debug this.
>  >
>  > Lee Boger
> 


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Christoph Gohlke
Use pylab.savefig('log_plot'). Also saving the figure to file and
showing it interactively in the same script might involve switching
backends, which might not work as expected.

It is advisable to downgrade to numpy 1.3.

-- Christoph

On 2/9/2010 10:44 AM, Lee Boger wrote:
> 
> Although, if I close the figure then re-run the script, a new figure
> pops up but it doesn't have any data plotted. Interpreter is now locked
> up. I'm still not fixing it completely. There is also no figure stored
> as a file log_plot.
> 
> Lee
> 
> 
> *Christoph Gohlke *
> 
> 02/09/2010 01:23 PM
> 
>   
> To
>   Lee Boger 
> cc
>   
> Subject
>   Re: [Matplotlib-users] Runtime Error - Need Advice
> 
> 
>   
> 
> 
> Caterpillar: Confidential GreenRetain Until: 03/11/2010
> 
> 
> 
> 
> Change the last line to pylab.show() and it should work.
> 
> Anyway, this example should not crash the interpreter. I can reproduce
> the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with
> mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0.
> 
> The shortest example that crashes is:
> 
> python -c "import pylab;pylab.subplot(111).figure.show()"
> 
> or on the interactive prompt:
> 
 import pylab
 pylab.subplot(111).figure.show()
 exit()
> Fatal Python error: PyEval_RestoreThread: NULL tstate
> 
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> 
> 
> -- Christoph
> 
> On 2/9/2010 7:57 AM, Lee Boger wrote:
>>
>> Windows XP Professional with Python 2.5 installed (pywin32 build 210) -
>> came with dSPACE software package
>>
>> Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>> sourceforge.net
>>
>> Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from
>> sourceforge.net
>>
>> Executing the following simple "log plot" script within PythonWin:
>>
>> *from* matplotlib *import* pylab
>>
>> # Create some artificial data.
>> test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>> 17, 18, 19, 20]
>> test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5,
>> -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>> spec_frequency = [6, 8]
>> spec_results = [-3.0, -3.0]
>>
>> # Plot
>> figure = pylab.subplot(111)
>> figure.semilogx()
>> figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>> edgecolors='none')
>> figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>> edgecolors='none')
>> figure.grid(True)
>> figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>> figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>>
>> figure.figure.savefig('log_plot')
>> figure.figure.show()
>>
>>
>> Plots a figure on the screen that looks correct, then the following
>> error (when I click OK, PythonWin closes)
>>
>>
>>
>> Any advice would be appreciated. Maybe it's an installation or setup
>> issue, but I'm pretty knew to Python programming and don't know how to
>> debug this.
>>
>> Lee Boger
>>
>>
>>
>> --
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the
> business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>>
>>
>>
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Eric Firing
Lee Boger wrote:
> 
> Windows XP Professional with Python 2.5 installed (pywin32 build 210) - 
> came with dSPACE software package
> 
> Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from 
> sourceforge.net
> 
> Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from 
> sourceforge.net

I suspect this is the problem: numpy-1.4.0 is considered broken and has 
been withdrawn.  Specifically, it introduces binary incompatibility with 
programs compiled against prior versions of numpy, including matplotlib.
If you go back to the numpy sourceforge site now, I think you will see 
an earlier version that you can install in place of 1.4.0 (after 
removing the latter).

Eric

> 
> Executing the following simple "log plot" script within PythonWin:
> 
> *from* matplotlib *import* pylab
> 
> # Create some artificial data.
> test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
> 17, 18, 19, 20]
> test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5, 
> -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
> spec_frequency = [6, 8]
> spec_results = [-3.0, -3.0]
> 
> # Plot
> figure = pylab.subplot(111)
> figure.semilogx()
> figure.scatter(test_frequency, test_results, s=20, c='b', marker='s', 
> edgecolors='none')
> figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s', 
> edgecolors='none')
> figure.grid(True)
> figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
> figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
> 
> figure.figure.savefig('log_plot')
> figure.figure.show()
> 
> 
> Plots a figure on the screen that looks correct, then the following 
> error (when I click OK, PythonWin closes)
> 
> 
> 
> Any advice would be appreciated. Maybe it's an installation or setup 
> issue, but I'm pretty knew to Python programming and don't know how to 
> debug this.
> 
> Lee Boger

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Christoph Gohlke
Change the last line to pylab.show() and it should work.

Anyway, this example should not crash the interpreter. I can reproduce
the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with
mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0.

The shortest example that crashes is:

python -c "import pylab;pylab.subplot(111).figure.show()"

or on the interactive prompt:

>>> import pylab
>>> pylab.subplot(111).figure.show()
>>> exit()
Fatal Python error: PyEval_RestoreThread: NULL tstate

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.


-- Christoph

On 2/9/2010 7:57 AM, Lee Boger wrote:
> > 
> > Windows XP Professional with Python 2.5 installed (pywin32 build 210) -
> > came with dSPACE software package
> > 
> > Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
> > sourceforge.net
> > 
> > Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from
> > sourceforge.net
> > 
> > Executing the following simple "log plot" script within PythonWin:
> > 
> > *from* matplotlib *import* pylab
> > 
> > # Create some artificial data.
> > test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
> > 17, 18, 19, 20]
> > test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5,
> > -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
> > spec_frequency = [6, 8]
> > spec_results = [-3.0, -3.0]
> > 
> > # Plot
> > figure = pylab.subplot(111)
> > figure.semilogx()
> > figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
> > edgecolors='none')
> > figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
> > edgecolors='none')
> > figure.grid(True)
> > figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
> > figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
> > 
> > figure.figure.savefig('log_plot')
> > figure.figure.show()
> > 
> > 
> > Plots a figure on the screen that looks correct, then the following
> > error (when I click OK, PythonWin closes)
> > 
> > 
> > 
> > Any advice would be appreciated. Maybe it's an installation or setup
> > issue, but I'm pretty knew to Python programming and don't know how to
> > debug this.
> > 
> > Lee Boger


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Verifying the Use of show()? Win XP

2010-02-09 Thread Wayne Watson
Thanks. Completely missed it. (P.S. Reply All +corrected mail filter.)

On 2/9/2010 8:18 AM, John Hunter wrote:
> On Tue, Feb 9, 2010 at 10:06 AM, Wayne Watson
>   wrote:
>
>> I'm sure not making much progress on understanding show(). When used in
>> XP in IDLE or by file execution (click on file name), it seems to tie up
>> the executing program.  In IDLE, the shell window stops and one must
>>  
...
>http://matplotlib.sourceforge.net/users/shell.html
>
> We recommend using ipython in pylab model when working interactively
> because it is designed to make the correct interactive settings and
> override "show" to be non-blocking.  You can obtain the right results
> in matplotlib using Idle if you are careful, but for "just works out
> of the box" ipython in pylab mode will be easier.
>
> JDH
>
>

-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Verifying the Use of show()? Win XP

2010-02-09 Thread John Hunter
On Tue, Feb 9, 2010 at 11:36 AM, Wayne Watson
 wrote:
> Thanks for the clarification. I'm really new to this, and do not know of
> interactive mode. I presume there's a command to turn it off and on, and
> possibly an example on how to do it. Is this method of operation with
> show() mentioned anywhere?

Yes, on the documentation link I referred you to.

JDH

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Verifying the Use of show()? Win XP

2010-02-09 Thread Wayne Watson
Thanks. I'll consider it. See my post to John Hunter moments ago as to 
why I "must" use IDLE. Basically, the users are not at all familiar with 
Python, and historically the us has been that way for 3-4 years.

On 2/9/2010 8:20 AM, Ben Axelrod wrote:
> Maybe instead of plot.show() you should do something like:
>
> plot.draw()
> raw_input('Press ENTER to exit')
>
> Personally, I also use IDLE on Windows XP to edit my matplotlib files.  
> However, I never execute in IDLE.  I simply double click the file in windows 
> explorer.
>
> -Ben
>
> -Original Message-
> From: Wayne Watson [mailto:sierra_mtnv...@sbcglobal.net]
> Sent: Tuesday, February 09, 2010 11:07 AM
> To: matplotlib-users@lists.sourceforge.net
> Subject: [Matplotlib-users] Verifying the Use of show()? Win XP
>
> I'm sure not making much progress on understanding show(). When used in XP in 
> IDLE or by file execution (click on file name), it seems to tie up the 
> executing program.  In IDLE, the shell window stops and one must exit the 
> window.
>
> I'd appreciate it if someone could take any examples 
> from  and try to execute them 
> as in the first paragraph to see if they terminate successfully.Let me know 
> what OS used, hopefully XP, and if you used IDLE or file execution.
> I suspect you will find every example there ends with show(). Try putting a 
> print statement after show() you've done it with the show() the last line.
> --
> "Crime is way down. War is declining. And that's far from the good news." -- 
> Steven Pinker (and other sources) Why is this true, but yet the media says 
> otherwise? The media knows very well how to manipulate us (see limbic, 
> emotion, $$). -- WTW
>
> --
> The Planet: dedicated and managed hosting, cloud storage, colocation Stay 
> online with enterprise data centers and the best network in the business 
> Choose flexible plans and management services without long-term contracts 
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Verifying the Use of show()? Win XP

2010-02-09 Thread Wayne Watson
Thanks for the clarification. I'm really new to this, and do not know of 
interactive mode. I presume there's a command to turn it off and on, and 
possibly an example on how to do it. Is this method of operation with 
show() mentioned anywhere?

The unfortunate present use of show() is that it ties up the shell 
script, where I happened to have written program output. It's handy to 
put it there, since it's meant to be interactive.  The user is keyboard 
arrowing through images, and statistical data is placed on the shell 
window. At the same time he sees a plot of data relevant to the image. 
He needs to close the plot window before going to the next image. I can 
probably figure out how to kill the plot window when he does that.

My problem with using ipython is that the program I'm modifying is used 
with IDLE, and people have gotten to use it that way. I had nothing to 
do with that method of op. I doubt any of the users would be agreeable 
to using ipython. None of them know Python. The next time the program is 
released, I may provide it in executable form.

I used matlab five years ago, for about two months. To see if it could 
help me understand MPL, I fired it up, and it's now working. Perhaps the 
interactive op is explained there. I take it there is no show() there?

Interesting mention of "non-blocking". In the midst of this dilemma, I 
started getting socket errors. Using McAffe I found pythonw as blocked. 
Would that be in anyway associated with the use of show()?   I've since 
changed it to outbound blocking.

On 2/9/2010 8:18 AM, John Hunter wrote:
> On Tue, Feb 9, 2010 at 10:06 AM, Wayne Watson
>   wrote:
>
...
>> the last line.
>>
> "show" is meant to start the GUI mainloop, which is usually blocking,
> and raise all windows, so the behavior you are reporting is the
> intended behavior.  When working interactively, as in Idle, you
> shouldn't need to use show if you turn interactive mode on.
>
>http://matplotlib.sourceforge.net/users/shell.html
>
> We recommend using ipython in pylab model when working interactively
> because it is designed to make the correct interactive settings and
> override "show" to be non-blocking.  You can obtain the right results
> in matplotlib using Idle if you are careful, but for "just works out
> of the box" ipython in pylab mode will be easier.
>
> JDH
>
>

-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] trying to Copy plot from one MplWidget canvas to another

2010-02-09 Thread Jae-Joon Lee
Copying a matplotlib canvas (or a figure, or an axes) is not easy. You
cannot just rebind it. You need to copy all the hierarchy of
underlying artists. Also the attributes of artists need to be adjusted
accordingly.
And best option in my opinion is just to create another canvas using
the code that created the original canvas.

Regards,

-JJ



On Mon, Feb 8, 2010 at 3:04 PM,   wrote:
> Hey folks,
>
> my problem may be obvious, but i can't seem to copy a plot from one canvas
> to another.
>
> # I have this object where whichCanvas is an instance of MplWidget (code
> shown below)
>
> self.whichCanvas.canvas.ax.plot(xData, yData, 'bo', linewidth=1.5,
> linestyle='-')
>
>
>
>
> # I want to copy the plot and axes to another MplWidget object
>
> self.anotherCanvas.canvas
>
>
>
> I've tried:
>
> self.anotherCanvas.canvas.ax = self.whichCanvas.canvas.ax
> self.anotherCanvas.canvas.draw()
>
> and
>
> self.anotherCanvas.canvas = self.whichCanvas.canvas
> self.anotherCanvas.canvas.draw()
>
> the plot doesn't seem to copy. Does any body more familiar with matplotlib
> have any suggestions?
>
>
>
>
>
> This is the MplWidget Class
> * MplWidget ***
>
> from PyQt4 import QtGui
> from matplotlib.backends.backend_qt4agg \
> import FigureCanvasQTAgg as FigureCanvas
> from matplotlib.figure import Figure
>
>
>
>
> class MplCanvas(FigureCanvas):
> def __init__(self):
> self.fig = Figure()
> self.ax = self.fig.add_subplot(111)
> FigureCanvas.__init__(self, self.fig)
> FigureCanvas.setSizePolicy(self,
> QtGui.QSizePolicy.Expanding,
> QtGui.QSizePolicy.Expanding)
> FigureCanvas.updateGeometry(self)
>
>
>
>
> class MplWidget(QtGui.QWidget):
>
> def __init__(self, parent = None):
> QtGui.QWidget.__init__(self, parent)
> self.canvas = MplCanvas()
> self.vbl = QtGui.QVBoxLayout()
> self.vbl.addWidget(self.canvas)
> self.setLayout(self.vbl)
>
>
>
> Regards,
> Dave Tung
>
> cell: 925-321-6657
> office: 510-353-4770
> dave.m.t...@seagate.com
>
> --
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the
> business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Figure.draw_artist() bug with Text

2010-02-09 Thread Jae-Joon Lee
Figure.draw_artist is just a convenience function.

def draw_artist(self, a):
"""
draw :class:`matplotlib.artist.Artist` instance *a* only --
this is available only after the figure is drawn
"""
assert self._cachedRenderer is not None
a.draw(self._cachedRenderer)

And, all the drawing is done by the artist itself.


>
> Also, other atists don't fail in this manner if I don't use 
> artist.set_figure().
>

As far as I can see, it only means that you're lucky with other artists.
The reason Text artists needs a reference to the figure is to access
the dpi value, as the exception indicates.
All artists are meant to be added to an axes (or at least "axes",
"figure", etc. attributes set appropriately) to work correctly.

Regards,

-JJ

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] his problems...

2010-02-09 Thread Nick Schurch
HI all,

I've been using matplotlip for a while now but mainly for line plots,
scatter plots and the odd dendrogram. I recently tried plotting a
histogram (of a binomial function) and encountered a problem. So I
though I'd try the extremely simple example set on the front of the
matplotlib page and heres what I got:

Python 2.4.3 (#1, Sep  3 2009, 15:37:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylab import randn, hist
>>> x = randn(1)
>>> hist(x, 100)
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", line
1633, in hist
ret =  gca().hist(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 5060, in hist
align=align, log=log)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 3253, in bar
assert len(height)==nbars, "argument 'height' must be %d or scalar" % nbars
AssertionError: argument 'height' must be 101 or scalar

Any idea why this isn't working? I have matplotlib v0.91.2 - will
updating to 0.99 solve the problem?
-- 
Cheers,

Nick Schurch

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Verifying the Use of show()? Win XP

2010-02-09 Thread Ben Axelrod
Maybe instead of plot.show() you should do something like:

plot.draw()
raw_input('Press ENTER to exit')

Personally, I also use IDLE on Windows XP to edit my matplotlib files.  
However, I never execute in IDLE.  I simply double click the file in windows 
explorer.

-Ben

-Original Message-
From: Wayne Watson [mailto:sierra_mtnv...@sbcglobal.net] 
Sent: Tuesday, February 09, 2010 11:07 AM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Verifying the Use of show()? Win XP

I'm sure not making much progress on understanding show(). When used in XP in 
IDLE or by file execution (click on file name), it seems to tie up the 
executing program.  In IDLE, the shell window stops and one must exit the 
window.

I'd appreciate it if someone could take any examples from 
 and try to execute them as in 
the first paragraph to see if they terminate successfully.Let me know what OS 
used, hopefully XP, and if you used IDLE or file execution. 
I suspect you will find every example there ends with show(). Try putting a 
print statement after show() you've done it with the show() the last line.
--
"Crime is way down. War is declining. And that's far from the good news." -- 
Steven Pinker (and other sources) Why is this true, but yet the media says 
otherwise? The media knows very well how to manipulate us (see limbic, emotion, 
$$). -- WTW

--
The Planet: dedicated and managed hosting, cloud storage, colocation Stay 
online with enterprise data centers and the best network in the business Choose 
flexible plans and management services without long-term contracts Personal 
24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Verifying the Use of show()? Win XP

2010-02-09 Thread John Hunter
On Tue, Feb 9, 2010 at 10:06 AM, Wayne Watson
 wrote:
> I'm sure not making much progress on understanding show(). When used in
> XP in IDLE or by file execution (click on file name), it seems to tie up
> the executing program.  In IDLE, the shell window stops and one must
> exit the window.
>
> I'd appreciate it if someone could take any examples from
>  and try to execute them
> as in the first paragraph to see if they terminate successfully.Let me
> know what OS used, hopefully XP, and if you used IDLE or file execution.
> I suspect you will find every example there ends with show(). Try
> putting a print statement after show() you've done it with the show()
> the last line.

"show" is meant to start the GUI mainloop, which is usually blocking,
and raise all windows, so the behavior you are reporting is the
intended behavior.  When working interactively, as in Idle, you
shouldn't need to use show if you turn interactive mode on.

  http://matplotlib.sourceforge.net/users/shell.html

We recommend using ipython in pylab model when working interactively
because it is designed to make the correct interactive settings and
override "show" to be non-blocking.  You can obtain the right results
in matplotlib using Idle if you are careful, but for "just works out
of the box" ipython in pylab mode will be easier.

JDH

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Verifying the Use of show()? Win XP

2010-02-09 Thread Wayne Watson
Version of Python would help too. I'm using 2.5.

On 2/9/2010 8:06 AM, Wayne Watson wrote:
> I'm sure not making much progress on understanding show(). When used in
> XP in IDLE or by file execution (click on file name), it seems to tie up
> the executing program.  In IDLE, the shell window stops and one must
> exit the window.
>
> I'd appreciate it if someone could take any examples from
>   and try to execute them
> as in the first paragraph to see if they terminate successfully.Let me
> know what OS used, hopefully XP, and if you used IDLE or file execution.
> I suspect you will find every example there ends with show(). Try
> putting a print statement after show() you've done it with the show()
> the last line.
>

-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Figure.draw_artist() bug with Text

2010-02-09 Thread Ben Axelrod
I see.  But why would I need to set the figure manually when I am drawing with 
a figure?  Is it ever the case where you set one figure, but draw with another? 
 For example:

textartist.set_figure(fig1)
fig2.draw_artist(textartist)

Also, other atists don't fail in this manner if I don't use artist.set_figure().

-Ben

-Original Message-
From: Jae-Joon Lee [mailto:lee.j.j...@gmail.com] 
Sent: Monday, February 08, 2010 6:36 PM
To: Ben Axelrod
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Figure.draw_artist() bug with Text

This is not a bug.
The exception is raised simply because "textartist.figure" is None (and it is 
None because you never set it).
"textartist" you created is not properly set up (no figure, no axes, no 
transform). You may do

textartist = Text(0.5, 0.5, "Foo")
textartist.set_figure(fig)
fig.draw_artist(textartist)
fig.canvas.blit(fig.bbox)

But, this is not the recommended way of doing things.
draw_artist is mainly for doing animation.

http://matplotlib.sourceforge.net/examples/animation/index.html

Regards,

-JJ

On Mon, Feb 8, 2010 at 4:24 PM, Ben Axelrod  wrote:
> I am getting a fault when I try to use Figure.draw_artist() with a 
> matplotlib.text.Text object.  Since matplotlib.text.Text inherits from 
> matplotlib.artist.Artist, which is what draw_artist() takes, this should 
> probably work.
>
> Tested with latest SVN code on Linux.
>
> Here is the traceback:
>
> Traceback (most recent call last):
>  File "test.py", line 10, in 
>    fig.draw_artist(textartist)
>  File "/usr/local/lib/python2.6/site-packages/matplotlib/figure.py", 
> line 816, in draw_artist
>    a.draw(self._cachedRenderer)
>  File "/usr/local/lib/python2.6/site-packages/matplotlib/artist.py", 
> line 55, in draw_wrapper
>    draw(artist, renderer, *kl)
>  File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", 
> line 549, in draw
>    bbox, info = self._get_layout(renderer)
>  File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", 
> line 267, in _get_layout
>    key = self.get_prop_tup()
>  File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", 
> line 716, in get_prop_tup
>    self.figure.dpi, id(self._renderer),
> AttributeError: 'NoneType' object has no attribute 'dpi'
>
> And here is some simple code to trigger the bug:
>
> #!/usr/bin/env python
> # display bug in figure.draw_artist(matplotlib.text)
> import matplotlib.pyplot as plt
> from matplotlib.text import Text
>
> fig = plt.figure()
> plt.draw()
>
> textartist = Text(0.5, 0.5, "Foo")
> fig.draw_artist(textartist)
>
> plt.show()
> #end code
>
> Note that I still get the bug even when i specify figsize and dpi on the 
> figure like so:
> fig = plt.figure(figsize=(2,2), dpi=300)
>
> -Ben
> --
>  The Planet: dedicated and managed hosting, cloud storage, 
> colocation Stay online with enterprise data centers and the best 
> network in the business Choose flexible plans and management services 
> without long-term contracts Personal 24x7 support from experience 
> hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Runtime Error - Need Advice

2010-02-09 Thread Lee Boger
Windows XP Professional with Python 2.5 installed (pywin32 build 210) - 
came with dSPACE software package

Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from 
sourceforge.net

Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from 
sourceforge.net

Executing the following simple "log plot" script within PythonWin:

from matplotlib import pylab

# Create some artificial data.
test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
17, 18, 19, 20]
test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5, 
-6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
spec_frequency = [6, 8]
spec_results = [-3.0, -3.0]

# Plot
figure = pylab.subplot(111)
figure.semilogx()
figure.scatter(test_frequency, test_results, s=20, c='b', marker='s', 
edgecolors='none')
figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s', 
edgecolors='none')
figure.grid(True)
figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)

figure.figure.savefig('log_plot')
figure.figure.show()


Plots a figure on the screen that looks correct, then the following error 
(when I click OK, PythonWin closes)



Any advice would be appreciated. Maybe it's an installation or setup 
issue, but I'm pretty knew to Python programming and don't know how to 
debug this.

Lee Boger<>--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Verifying the Use of show()? Win XP

2010-02-09 Thread Wayne Watson
I'm sure not making much progress on understanding show(). When used in 
XP in IDLE or by file execution (click on file name), it seems to tie up 
the executing program.  In IDLE, the shell window stops and one must 
exit the window.

I'd appreciate it if someone could take any examples from 
 and try to execute them 
as in the first paragraph to see if they terminate successfully.Let me 
know what OS used, hopefully XP, and if you used IDLE or file execution. 
I suspect you will find every example there ends with show(). Try 
putting a print statement after show() you've done it with the show() 
the last line.
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hatching problem

2010-02-09 Thread Jae-Joon Lee
I cannot reproduce it with Agg backend and ps backend. I tried both
svn version and 0.99 maint. version.
So, maybe this is a bug in mac os X backend?
Do you see a same problem with the ps output? If so, can you post your
ouput ps file?

Regards,

-JJ


On Mon, Feb 8, 2010 at 3:26 PM, Tomasz Koziara
 wrote:
> Dear Users/Developers
>
> I just installed version 0.99.1.1 since in my previous version (0.98) I had
> problems with hatching. It seems though that the same problems persist in
> the current version. The attached files reproduce the problem (a data file
> and a python short script). Note that hatching is not present on all green
> 'CONUPD' fields - but only on few of them.
>
> I will appreciate some hints on how to get by,
> Regards
> Tomek
>
> ===
>
>
>
>
>
>
> ===
>
> dh178-192:tkp5 tomek$ python plots.py --verbose-helpful
> $HOME=/Users/tomek
> CONFIGDIR=/Users/tomek/.matplotlib
> matplotlib data path /Library/Python/2.5/site-packages/matplotlib/mpl-data
> loaded rc file
> /Library/Python/2.5/site-packages/matplotlib/mpl-data/matplotlibrc
> matplotlib version 0.99.1.1
> verbose.level helpful
> interactive is False
> units is False
> platform is darwin
> Using fontManager instance from /Users/tomek/.matplotlib/fontList.cache
> backend MacOSX version unknown
> findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> to Bitstream Vera Sans
> (/Library/Python/2.5/site-packages/matplotlib-0.98.6svn-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> with score of 0.00
> findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=large
> to Bitstream Vera Sans
> (/Library/Python/2.5/site-packages/matplotlib-0.98.6svn-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> with score of 0.00
>
>
> --
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the
> business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Memory leak when destroying Tk frame containing a figure

2010-02-09 Thread Stephan Markus
I already had my destroy() method look like this:

def destroy(self):
self.f.clf()
Tix.Frame.destroy(self)
self.toolbar.destroy()
self.canvas._tkcanvas.destroy()


But it makes no difference.

Stephan

Am 08.02.2010 17:15, schrieb Michael Droettboom:
> Have you tried explicitly calling .clf() on the matplotlib Figure object from 
> your Tix.Frame.destroy callback?
>
> Mike
>
>   

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hatching problem

2010-02-09 Thread Tomasz Koziara

Dear Users/Developers

I just installed version 0.99.1.1 since in my previous version (0.98)  
I had problems with hatching. It seems though that the same problems  
persist in the current version. The attached files reproduce the  
problem (a data file and a python short script). Note that hatching is  
not present on all green 'CONUPD' fields - but only on few of them.


I will appreciate some hints on how to get by,
Regards
Tomek

===


cubes_1_PSEUDO_RIGID_FULL
Description: Binary data



#!/usr/bin/env python
# a stacked bar plot with errorbars
import numpy as np
import matplotlib.pyplot as plt

inp = open ("cubes_1_PSEUDO_RIGID_FULL", "r")
dat = [[],[],[],[],[],[],[],[],[],[],[]]
lin = inp.readline ()
num = 0
while lin != "":
  lst = lin.rsplit (" ")
  lin = inp.readline ()
  if len (lst) > 2:
dat [num % 11].append (float (lst [2]))
num = num + 1

N = 8
TIMINT = np.array (dat [0])
CONUPD = np.array (dat [1])
CONDET = np.array (dat [2])
LOCDYN = np.array (dat [3])
CONSOL = np.array (dat [4])
PARBAL = np.array (dat [5])
ind = np.arange(N)
width = 0.6

p1 = plt.bar (ind, TIMINT, width, color='r')
p2 = plt.bar (ind, CONUPD, width, color='g', bottom=TIMINT, hatch='//')
p3 = plt.bar (ind, CONDET, width, color='b', bottom=TIMINT+CONUPD, hatch='.')
p4 = plt.bar (ind, LOCDYN, width, color='y', bottom=TIMINT+CONUPD+CONDET, hatch='o')
p5 = plt.bar (ind, CONSOL, width, color='c', bottom=TIMINT+CONUPD+CONDET+LOCDYN, hatch='*')
p6 = plt.bar (ind, PARBAL, width, color='m', bottom=TIMINT+CONUPD+CONDET+LOCDYN+CONSOL, hatch='O')

plt.ylabel ('Time [s]')
plt.title ('Runtimes by processor count')
plt.xticks (ind+width/2., ('1', '2', '4', '8', '16', '32', '64', '128') )
plt.legend ((p6[0], p5[0], p4[0], p3[0], p2[0], p1[0]), ('PARBAL', 'CONSOL', 'LOCDYN', 'CONDET', 'CONUPD', 'TIMEINT'), loc = "upper left")
plt.axis (xmin = -0.2, xmax = ind[N-1]+width+0.2)
plt.savefig ('cubes-1-prb-full.eps')
plt.clf ()



===

dh178-192:tkp5 tomek$ python plots.py --verbose-helpful
$HOME=/Users/tomek
CONFIGDIR=/Users/tomek/.matplotlib
matplotlib data path /Library/Python/2.5/site-packages/matplotlib/mpl- 
data
loaded rc file /Library/Python/2.5/site-packages/matplotlib/mpl-data/ 
matplotlibrc

matplotlib version 0.99.1.1
verbose.level helpful
interactive is False
units is False
platform is darwin
Using fontManager instance from /Users/tomek/.matplotlib/fontList.cache
backend MacOSX version unknown
findfont: Matching :family=sans- 
serif:style 
=normal:variant=normal:weight=normal:stretch=normal:size=medium to  
Bitstream Vera Sans (/Library/Python/2.5/site-packages/ 
matplotlib-0.98.6svn-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/ 
fonts/ttf/Vera.ttf) with score of 0.00
findfont: Matching :family=sans- 
serif:style 
=normal:variant=normal:weight=normal:stretch=normal:size=large to  
Bitstream Vera Sans (/Library/Python/2.5/site-packages/ 
matplotlib-0.98.6svn-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/ 
fonts/ttf/Vera.ttf) with score of 0.00


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users