Re: [Matplotlib-users] Can matplotlib be run from PythonWin IDE ininteractive mode?

2008-12-06 Thread Thomas Pfaff
Hi,

does that mean that it works for you with PyScripter?
Right now the only way to do more than one plot with MPL with PyScripter is 
to reinitialize the remote python interpreter over and over again.
If you found a way around that I would be glad to hear about it.

To the rest:
Might there be a way to mimick IPython's behavior of 'creating separate 
threads' (or whatever it might be that makes IPython do the trick) while 
importing matplotlib? IPython is great but having an editor/integrated 
debugger with all the other goodies that PyScripter offers PLUS interactive 
matplotlib-plotting would be even greater...

Cheers,


Thomas

- Original Message - 
From: Elfnor [EMAIL PROTECTED]
To: matplotlib-users@lists.sourceforge.net
Sent: Wednesday, December 03, 2008 11:05 PM
Subject: [Matplotlib-users] Can matplotlib be run from PythonWin IDE 
ininteractive mode?



 Hi

 I'm giving an introductory talk on matplotlib to colleagues next week. I'd
 like to run matplotlib in interactive mode from the PythonWin IDE. Is this
 possible?

 I use PyScripter or occasionally IPython myself, but the python group I'm
 talking to have all been set up with PythonWin and my brief is to avoid
 confusing then with another IDE.

 thanks Eleanor
 -- 
 View this message in context: 
 http://www.nabble.com/Can-matplotlib-be-run-from-PythonWin-IDE-in-interactive-mode--tp20822638p20822638.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.



 


--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] no canvas reinitialization between calls to savefig

2008-10-31 Thread Thomas Pfaff
Hi,

Thanks for the quick reply.


My OS is Windows XP with Service Pack 3

I'm using an easy-install .egg distribution. Whether I downloaded it
somewhere or simply installed it using easy-install, I don't remember.

I have another version of matplotlib (0.91.2) installed, which does not seem
to be used. This one was installed using the Windows installer from the
matplotlib homepage. This should not interfere, should it?

Running the script with --verbose-helpful gives the following results (I
removed parts of the path information)

$HOME=\pfaff
CONFIGDIR=\pfaff\.matplotlib
matplotlib data path
\python25\lib\site-packages\matplotlib-0.98.3-py2.5-win32.egg\matplotlib\mpl
-data
loaded rc file
\python25\lib\site-packages\matplotlib-0.98.3-py2.5-win32.egg\matplotlib\mpl
-data\matplotlibrc
matplotlib version 0.98.3
verbose.level helpful
interactive is False
units is False
platform is win32
Using fontManager instance from \pfaff\.matplotlib\fontManager.cache
backend TkAgg version 8.4


Now that I think of it:
In the IPython reference, I read about possible problems with tk. When
starting IPython I use -pylab -tk because otherwise I can only do one plot
and the plotting window hangs once I issue another plotting command.
As I didn't find where to tell matplotlib to behave like these two switches
were set, I get by with constantly restarting my interpreter when working
interactively.
Could this be part of the problem?

Cheers,


Thomas

 -Original Message-
 From: Michael Droettboom [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 30, 2008 2:21 PM
 To: Thomas Pfaff
 Cc: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] no canvas reinitialization between calls
 to savefig
 
 I can't reproduce this here with SVN trunk.  I get what you expect.
 
 Can you provide the information outlined here:
 
 http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-
 problem
 
 as well as the backend you are using?
 
 Cheers,
 Mike
 



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


Re: [Matplotlib-users] no canvas reinitialization between calls to savefig

2008-10-31 Thread Thomas Pfaff
Hi Jae-Joon,

yes, that solved it. Thank you very much.

The savefig command should have been inside the for-loop.


Thomas

 -Original Message-
 From: Jae-Joon Lee [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 31, 2008 12:43 PM
 To: Thomas Pfaff
 Cc: Michael Droettboom; matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] no canvas reinitialization between calls
 to savefig
 
 I can reproduce Thomas' problem with Agg backend. It does not happen
 if frame_on is True.
 And I guess Thomas' guess in the first email might be right.
 I had a quick look at the mpl source and I don't think draw(),  clf()
 or savefig() try to clear the canvas.
 The problem is not visible if frame_on is True.
 
 Thomas,
 Put following line after the savefig() function
 
fig.canvas._lastKey = None
 
 and see if it solves the problem (savefig command in your original
 email is outside the for loop, I guess this was a typo).
 
 The Agg backend has a clear() method which fills the canvas with (1,
 1, 1, 0).  I tried to put this method in a few different places.  It
 worked for savefig(), but I couldn't get it work in the interactive
 backend (GtkAgg).
 
 Regards,
 



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


[Matplotlib-users] no canvas reinitialization between calls to savefig

2008-10-30 Thread Thomas Pfaff
Hello,

I'm having a problem reusing a figure with the savefig command.
I want to generate image timeseries with GoogleEarth displaying weather
radar data, so my plot geometry is the same always and only the color of the
patches which represent measurements changes over time.
Now I want those portions of the image, where no precipitation occurs to be
transparent so I was thinking about setting the visibility of those Polygons
to False and that would be it.

Unfortunately savefig seems to reuse the image it created before when called
a second time.

I wrote this example code.

##
#start
#set some image parameters
figsize = (1.,1.)
dpi = 300
rect = [0.,0.,1.,1.]
#get figure and axes objects
fig = plt.figure(figsize=figsize, dpi=dpi, frameon=False)
ax = fig.add_axes(rect, frameon=False)
ax.set_aspect(1.0)

#create two polygons, one filling the left half of the image
# one the right half
poly1 = Polygon(([0,0],[0.5,0],[0.5,1],[0,1],[0,0]), fill=True)
ax.add_patch(poly1)
poly2 = Polygon(([0.5,0],[1,0],[1,1],[0.5,1],[0.5,0]), fill=True)
ax.add_patch(poly2)

# basic colors black, red, green, blue
colors=['#00','#ff','#00ff00','#ff']
# switch for the left polygon
values =[-1, 1, -1, 1]
for value, color in zip(values, colors):
if value  0:
poly1.set_visible(False)
else:
poly1.set_visible(True)
poly1.set_facecolor(color)
poly2.set_facecolor(color)
 
plt.savefig('test'+color[1:]+'.png',dpi=dpi,format='png',transparent=True)
# end
##


Now, what I expect and what I get is:

Test00.png: black on the right side, transparent with tick marks on the
left - this is what I get.

Testff.png: red on both sides with tick marks visible - This is what I
get.

Test00ff00.png: green on the right side, transparent on the left. What I get
is green on the right and red on the left. So the red from the previous
patch has been retained

Testff.png: blue on both sides, which is what I get as well.


So apparently the plot is updated, but only in places where something is
actually drawn. The rest remains unchanged and so transparency is not
restored.

I tried using clf, cla, deleting objects. In all cases savefig just always
produced the first image over and over, most probably because nothing new
was drawn.

I even tried to remove fig's canvas object, hoping that the library might
create a new one, but that only gave me a traceback.


Any ideas what I'm doing wrong or how I could solve this problem?

Thank you very much in advance,


Thomas

-- 
Using Python2.5, matplotlib 0.98.3, numpy 1.1.1, matplotlib.basemap 0.99.1
On WindowsXP SP3, Pentium4 DualCore 3.4GHz, 3GB RAM


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


[Matplotlib-users] savefig doesn't clear canvas

2008-10-30 Thread Thomas Pfaff
Hello,

I started off with the Polygon plotting example of the basemap toolkit as I
want to visualize Radar data with GoogleEarth.
I have a polygon shapefile and another data file in which I have one value
for each of the polygons.
I do the basemap.read_shapefile and the axes.add_patch stuff once in the
beginning, keeping a list of the polygon-instances.
Then, for each data file I set the face color of the polygons according to
their respective value and call pyplot.savefig() to save to a png file. This
way I have to do the time and memory consuming task of reading the shapefile
and producing the polygon patches (~4) only once at the beginning.

That worked splendidly.

Now I wanted some data values to be transparent (so that only rainfall is
actually drawn). So I thought about using set_visible(None) on the
respective polygons.
That seems to work as well, but now I have the problem, that wherever a
polygon becomes invisible, the patch from the previous run remains visible.

So apparently, the figure's canvas (or whatever object is responsible for
the final image pixels) is not initialized between subsequent calls to
savefig.
I searched a bit through the code of figure.py, backend_bases.py,
backend_agg.py but didn't find any method that looked like it would erase
the canvas.
If I do clf() then savefig() always saves the same image over and over
again. I suppose it's because no new data is drawn to the canvas in this
case.

Any ideas, how to solve this?

Thank you for your help


Thomas


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