Re: [Matplotlib-users] Plotting loop refuses to update display on OS X

2008-10-04 Thread Jae-Joon Lee
functions like raw_input blok the mianloop of some gui backends (e.g.,
gtk) but work fine with some other backend (although Tk is the only
backend I know of). So my guess is that you used a different backend
with 0.98.1.
I guess you have a few options.

 * try different backend (Tk) with 0.98.3
 * use ginput
 * or try a ginput-like routine that I made sometime ago which works
okay with raw_input.
   
http://sourceforge.net/mailarchive/message.php?msg_id=6e8d907b0803101609s7bd8fecaj851a6ecf1ab2a316%40mail.gmail.com

IHTH,

-JJ


On Thu, Oct 2, 2008 at 5:18 PM, Zane Selvans [EMAIL PROTECTED] wrote:
 I have a Python module that I've written with some pylab plotting
 routines in it.  One of them loops over a list of objects, generating
 some plots based on the data associated with each list member in
 turn.  It's meant to be an interactive way to step through the list
 and see what the things look like.

 I have the loop set up to wait for user input before going on to the
 next object, using

 x = raw_input(press return for next fit: )

 but for some reason, the plot window never updates.  I've tried
 putting both draw() and show() immediately
 before the raw_input() line, and neither works.  The plot only seems
 to update when I ctrl-C out of the loop, and otherwise, I just get the
 spinning beachball when I mouseover the plot.

 I'm using Matplotlib 0.98.3 on OS X (10.5.5) with the built-in python
 from Apple I think (2.5.1).  I'm calling the plotting routine from
 ipython 0.8.3 using the -pylab option.

 The same script previously worked fine under Matplotlib 0.98.1

 Other plotting routines from the same module seem to work fine - it's
 only this plot within a loop that's giving me trouble.

 Any ideas?

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







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


-
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] Clear Figure

2008-10-04 Thread rocha
Hi Guys,

I need to clear the Figure after the user has clicked the some button in 
PyQt, but when I try to plot the graphics again nothing appear. In 
ipython it works, but when I try it inside my application it does not 
work. What am I missing?

Inside my MplCanvas class (actually it is a QWidget - see 
embedding_in_qt4.py in matplotlib examples file - user_interface) I have 
this code:

self.fig = Figure(figsize=(self.width, self.height), dpi=dpi)  

And then in my main application I'm trying to do:

self.canvas.figure.clf()
self.canvas.draw()
self.canvas.axes.plot([1.,2.,4.])

and nothing is plotted. The Figure is totally gray. I tried to do the 
same thing in embedding_in_qt4.py example, modifying some parts, but it 
didn't work too.

Do you have any suggestions?

Thanks!
Best regards,
Bernardo M. Rocha

-
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] formatting figures for publciation

2008-10-04 Thread Eric Firing
John Hunter wrote:
 On Sat, Sep 27, 2008 at 1:04 PM, Eric Firing [EMAIL PROTECTED] wrote:
 
 Good answer, but there may be one exception.  The Matlab function
 description indicates that it can produce eps files with the cmyk color
 space, which is indeed something that publishers tend to want, and
 something that we don't do.  Whether Matlab does it well, and whether
 with some reasonable modification to the mpl ps backend we could do at
 least as well, I don't know.
 
 This is certainly something that would be nice to have.  There was
 some recent work on agg to support different colorspaces, I think CMYK
 was among them, but it hasn't yet been contributed into the mainline
 as far as I know.  It would take quite a bit of work for us to support
 a generic colorspace model, but it would be a nice feature

John,

Is it still true that we will not be able to take advantage of any agg 
improvements because of the agg license change?

Eric

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


Re: [Matplotlib-users] Clear Figure

2008-10-04 Thread Jae-Joon Lee
I guess you need to put draw() after plot()

self.canvas.figure.clf()
self.canvas.axes.plot([1.,2.,4.])
self.canvas.draw()

Let us know if it does not help.

-JJ



On Sat, Oct 4, 2008 at 7:17 PM, rocha [EMAIL PROTECTED] wrote:
 Hi Guys,

 I need to clear the Figure after the user has clicked the some button in
 PyQt, but when I try to plot the graphics again nothing appear. In
 ipython it works, but when I try it inside my application it does not
 work. What am I missing?

 Inside my MplCanvas class (actually it is a QWidget - see
 embedding_in_qt4.py in matplotlib examples file - user_interface) I have
 this code:

 self.fig = Figure(figsize=(self.width, self.height), dpi=dpi)

 And then in my main application I'm trying to do:

 self.canvas.figure.clf()
 self.canvas.draw()
 self.canvas.axes.plot([1.,2.,4.])

 and nothing is plotted. The Figure is totally gray. I tried to do the
 same thing in embedding_in_qt4.py example, modifying some parts, but it
 didn't work too.

 Do you have any suggestions?

 Thanks!
 Best regards,
 Bernardo M. Rocha

 -
 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


-
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] vertical padding in legend

2008-10-04 Thread Eric Firing
John Hunter wrote:
 On Tue, Sep 30, 2008 at 5:07 PM, Jae-Joon Lee [EMAIL PROTECTED] wrote:
 
 The problem is already well explained by Eric. And my solution is to
 interpret the legend.pad as a fraction of the textsize (pad=0.3 seems
 to work fine in my eyes). Note that this breaks the backward
 compatibility. I personally think the original behavior may have
 produced unsatisfactory results in most of the cases and keeping it as
 a default may not be a good idea. While I hope others come out with an
 elegant solution, I prefer to break the API in this case.
 
 How about using a new kwarg and raising an exception if the old one is
 passed in, with the exception pointing to the new arg?  I am a little
 uncomfortable silently changing the meaning of the old arg.

Done, except that it just raises a warning, and still works with the old 
kwarg.  The new kwarg is borderpad; it is used if pad==0, which is the 
new rc default.  I set the default borderpad=0.5.

There is still too much other positioning in legend that is based on 
axes units.  I briefly tried to start changing others, again with 
additional kwargs, and things quickly fell apart.  Legend needs 
considerable reworking to take full advantage of the transforms 
framework (and maybe other mpl improvements since the original legend) 
and to put all positioning kwargs and code in sensible units.  It is 
amazing that the present code works as well as it does.

The way to make a transition may be via a separate version for a while.
There could be a single interface, with a kwarg to choose the version.

Eric


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


Re: [Matplotlib-users] plotting numbers on axes in scientific notation

2008-10-04 Thread Eric Firing
Fabrice Silva wrote:
 Le mardi 09 septembre 2008 à 08:26 -0400, Michael Droettboom a écrit :
 You can use

 def ticklabel_format(self, **kwargs):
 It did not figure how to use that!
 I've tried in ipython :
 import numpy as np
 t = np.linspace(0,1,1024)
 f = np.sin(10*t)/1e5
 plot(t,f)
 ax = gca()
 ax.ticklabel_format(style='sci', axis='y')

   ax.yaxis.major.formatter.set_powerlimits((0,0))

 show()
 
 but the yticklabels are still in plain notation...
 I've googled, but I still can not find where I am wrong!

Yes, this is confusing. The problem is that the scientific style uses 
scientific notation only for sufficiently large or small numbers, with 
thresholds determined by the powerlimits parameter.  The line I added 
above will force scientific notation.

The ticklabel_format method needs another kwarg to enable setting the 
powerlimits.

Eric


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


Re: [Matplotlib-users] plotting numbers on axes in scientific notation

2008-10-04 Thread Eric Firing
Eric Firing wrote:
 Fabrice Silva wrote:
 Le mardi 09 septembre 2008 à 08:26 -0400, Michael Droettboom a écrit :
 You can use

 def ticklabel_format(self, **kwargs):
 It did not figure how to use that!
 I've tried in ipython :
 import numpy as np
 t = np.linspace(0,1,1024)
 f = np.sin(10*t)/1e5
 plot(t,f)
 ax = gca()
 ax.ticklabel_format(style='sci', axis='y')
 
ax.yaxis.major.formatter.set_powerlimits((0,0))
 
 show()

 but the yticklabels are still in plain notation...
 I've googled, but I still can not find where I am wrong!
 
 Yes, this is confusing. The problem is that the scientific style uses 
 scientific notation only for sufficiently large or small numbers, with 
 thresholds determined by the powerlimits parameter.  The line I added 
 above will force scientific notation.
 
 The ticklabel_format method needs another kwarg to enable setting the 
 powerlimits.

Done in svn 6148.  I called the kwarg 'scilimits' to emphasize that it 
works with the 'sci' style; if there are comments to the effect that I 
should have called it 'powerlimits' for consistency with the 
corresponding ScalarFormatter method, I can change it.

With the change in svn, instead of the line I added above, your call to 
ticklabel_format would be:

ax.ticklabel_format(style='sci', scilimits=(0,0), axis='y')

Eric


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