Re: [Matplotlib-users] DreamPie (a new Python shell) and matplotlib

2010-09-06 Thread Noam Yorav-Raphael
The intended audience of IPython and DreamPie is, I think, quite
similar. Perhaps DreamPie is more suitable for less computer-savvy
people, as it is a GUI application and not a terminal-based one.

I've seen that "ipython --pylab" goes to interactive mode by default,
and has a %run command which runs scripts in non-interactive mode.
Will a behavior like this be fine?

Thanks,
Noam




On Fri, Sep 3, 2010 at 10:17 AM, Eric Firing  wrote:
>
> On 09/02/2010 07:47 PM, Noam Yorav-Raphael wrote:
> > Hello,
> >
> > I'm the developer of DreamPie, a new graphical Python shell (you can
> > check it out at http://dreampie.sourceforge.net )
> >
> > I worked to make it work nicely with matplotlib -- it runs Tk/GTK/Qt
> > event loops when idle, so if matplotlib is in interactive mode it
> > works great. I even made DreamPie check if matplotlib in
> > non-interactive mode is present, and if so it shows you a message
> > suggesting that you switch to interactive mode.
> >
> > Lately I thought that it may be much easier for users if DreamPie
> > would just switch matplotlib to interactive mode automatically.
> > However, I'm not entirely comfortable with the idea of changing
> > settings silently.
> >
> > I wanted to ask: what do you think? Are there any cases when you want
> > to have matplotlib in non-interactive mode in a shell?
>
> At least with ipython, yes--the point of non-interactive mode is that
> the show() function blocks, so it can be used in scripts in which the
> user is supposed to see a plot, dismiss the window, see another plot,
> etc. Again, at least with ipython, one wants to be *able* to run scripts
> exactly as they would run from the command line.
>
> Whether this sort of thing matters for DreamPie depends on the intended
> uses and users.
>
> Eric
>
> >
> > Also, are there any other ways in which DreamPie can be made more
> > matplotlib-friendly?
> >
> > Thanks,
> > Noam
> >
> > --
> > This SF.net Dev2Dev email is sponsored by:
> >
> > Show off your parallel programming skills.
> > Enter the Intel(R) Threading Challenge 2010.
> > http://p.sf.net/sfu/intel-thread-sfd
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> --
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DreamPie (a new Python shell) and matplotlib

2010-09-06 Thread Michele De Stefano
I think the answer is yes (at least for me). A behavior like the one
of ipyhton is fine.

Eric, is DreamPie able to run parallel jobs like IPython or not ?
If not, are you thinking to support a behavior like that ?

I think it is very useful for trying to run parallel jobs
interactively, most of all if you want to test MPI programs.

2010/9/6 Noam Yorav-Raphael :
> The intended audience of IPython and DreamPie is, I think, quite
> similar. Perhaps DreamPie is more suitable for less computer-savvy
> people, as it is a GUI application and not a terminal-based one.
>
> I've seen that "ipython --pylab" goes to interactive mode by default,
> and has a %run command which runs scripts in non-interactive mode.
> Will a behavior like this be fine?
>
> Thanks,
> Noam
>
>
>
>
> On Fri, Sep 3, 2010 at 10:17 AM, Eric Firing  wrote:
>>
>> On 09/02/2010 07:47 PM, Noam Yorav-Raphael wrote:
>> > Hello,
>> >
>> > I'm the developer of DreamPie, a new graphical Python shell (you can
>> > check it out at http://dreampie.sourceforge.net )
>> >
>> > I worked to make it work nicely with matplotlib -- it runs Tk/GTK/Qt
>> > event loops when idle, so if matplotlib is in interactive mode it
>> > works great. I even made DreamPie check if matplotlib in
>> > non-interactive mode is present, and if so it shows you a message
>> > suggesting that you switch to interactive mode.
>> >
>> > Lately I thought that it may be much easier for users if DreamPie
>> > would just switch matplotlib to interactive mode automatically.
>> > However, I'm not entirely comfortable with the idea of changing
>> > settings silently.
>> >
>> > I wanted to ask: what do you think? Are there any cases when you want
>> > to have matplotlib in non-interactive mode in a shell?
>>
>> At least with ipython, yes--the point of non-interactive mode is that
>> the show() function blocks, so it can be used in scripts in which the
>> user is supposed to see a plot, dismiss the window, see another plot,
>> etc. Again, at least with ipython, one wants to be *able* to run scripts
>> exactly as they would run from the command line.
>>
>> Whether this sort of thing matters for DreamPie depends on the intended
>> uses and users.
>>
>> Eric
>>
>> >
>> > Also, are there any other ways in which DreamPie can be made more
>> > matplotlib-friendly?
>> >
>> > Thanks,
>> > Noam
>> >
>> > --
>> > This SF.net Dev2Dev email is sponsored by:
>> >
>> > Show off your parallel programming skills.
>> > Enter the Intel(R) Threading Challenge 2010.
>> > http://p.sf.net/sfu/intel-thread-sfd
>> > ___
>> > Matplotlib-users mailing list
>> > Matplotlib-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> --
>> This SF.net Dev2Dev email is sponsored by:
>>
>> Show off your parallel programming skills.
>> Enter the Intel(R) Threading Challenge 2010.
>> http://p.sf.net/sfu/intel-thread-sfd
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> --
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>



-- 
Michele De Stefano
http://www.linkedin.com/in/micdestefano
http://code.google.com/p/mds-utils
http://micheledestefano.xoom.it

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] legend: changing the text colour

2010-09-06 Thread karianne

Thank you, JJ, this solves my problems.

I have one question to your reply:

Jae-Joon Lee wrote:
> 
> col, leg = "b", "test"
> errorbar([1,2,3], [1,2,1],xerr=[0.1, 0.1, 0.1], yerr=[0.1, 0.1, 0.1],
>  fmt='.',color=col)
> l2, = plot([],[], "+", color=col)
> l2.remove() # remove from the axes
> 
> legend([l2], [leg])
> 

Does it make a difference whether I remove l2 from the axes or not? I can't
see that it is plotting anything at all so I am curious as to what I am
missing here..

Cheers, Karianne
-- 
View this message in context: 
http://old.nabble.com/legend%3A-changing-the-text-colour-tp29614647p29632842.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] legend: changing the text colour

2010-09-06 Thread karianne

Thank you, JJ, this solves my problems.

I have one question to your reply:

Jae-Joon Lee wrote:
> 
> col, leg = "b", "test"
> errorbar([1,2,3], [1,2,1],xerr=[0.1, 0.1, 0.1], yerr=[0.1, 0.1, 0.1],
>  fmt='.',color=col)
> l2, = plot([],[], "+", color=col)
> l2.remove() # remove from the axes
> 
> legend([l2], [leg])
> 

Does it make a difference whether I remove l2 from the axes or not? I can't
see that it is plotting anything at all so I am curious as to what I am
missing here..

Cheers, Karianne
-- 
View this message in context: 
http://old.nabble.com/legend%3A-changing-the-text-colour-tp29614647p29632843.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DreamPie (a new Python shell) and matplotlib

2010-09-06 Thread Noam Yorav-Raphael
On Mon, Sep 6, 2010 at 3:28 PM, Michele De Stefano
 wrote:
> I think the answer is yes (at least for me). A behavior like the one
> of ipyhton is fine.

Thanks for the answer. If anyone agrees or disagrees, I would like to know.
>
> Eric, is DreamPie able to run parallel jobs like IPython or not ?
> If not, are you thinking to support a behavior like that ?
>
> I think it is very useful for trying to run parallel jobs
> interactively, most of all if you want to test MPI programs.

DreamPie doesn't support running parallel jobs. I don't plan to
support such a feature in DreamPie - I actually think it should be the
job of a shell-independent library. The job of the shell would be to
let you interact easily with the library.

Thanks for the feedback!
Noam

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Updating legends in dynamic plot

2010-09-06 Thread G Jones
Hello,
I have a Qt4 application with dynamic embedded matplotlib plotting.
The application allows the user to add and remove lines from the plot.
This all works well, but I have found that updating the legend is
causing a memory leak. What is the proper way to update the legend in
an animated/dynamic context? The attached stand alone example
exemplifies the problem. On my system, with matplotlib.__version__
'1.0.0' compiled from SVN, the memory slowly increases as the script
runs. This does not happen if I remove the ax.legend() call. The del
ax.legend_ line seems to have no effect. I tried finding the artists
associated with the legend What's the appropriate way to update the
legend to avoid this behavior? I just found ax.legend_.remove() but it
raises NotImplementedError

Thanks,
Glenn
import matplotlib
matplotlib.use('Qt4Agg')
import matplotlib.pyplot as plt
import numpy as np

f = plt.figure()
ax = f.add_subplot(111)

l, = ax.plot(np.arange(100),np.random.randn(100),label='hi',animated=True)
ax.legend()
print "press enter to start"
raw_input()

for k in range(1):
l.set_ydata(np.random.randn(100))
del ax.legend_
ax.legend() #prop = matplotlib.font_manager.FontProperties(size='small'))
f.canvas.draw()--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] aligning multiple legends

2010-09-06 Thread Paul Ivanov
I want to have two legends (from different axes) positioned right up
against on another.

Here's a static example, except I want the second legend to be defined
relative to the first (if leg is moved, I want leg2 to move as well). I
can't seem to figure out the proper bbox_to_anchor and bbox_transform
parameters to pass to the second legend() to make this work.

# small example
ax = plt.subplot(1,1,1)
ax2 = ax.twinx()
ax.plot([0,1], label='ax1')
ax2.plot([1,0], 'r--',label='ax2')
leg = ax.legend(loc='lower left', borderaxespad=0,
bbox_to_anchor=(.85,.85))
leg2 = ax2.legend(loc='upper left', borderaxespad=0,
bbox_to_anchor=(.85,.85))

thanks in advance,
Paul Ivanov

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] aligning multiple legends

2010-09-06 Thread Paul Ivanov
Paul Ivanov, on 2010-09-06 18:01, wrote:
> I want to have two legends (from different axes) positioned right up
> against on another.
> 
> Here's a static example, except I want the second legend to be defined
> relative to the first (if leg is moved, I want leg2 to move as well). I
> can't seem to figure out the proper bbox_to_anchor and bbox_transform
> parameters to pass to the second legend() to make this work.
> 
> # small example
> ax = plt.subplot(1,1,1)
> ax2 = ax.twinx()
> ax.plot([0,1], label='ax1')
> ax2.plot([1,0], 'r--',label='ax2')
> leg = ax.legend(loc='lower left', borderaxespad=0,
>   bbox_to_anchor=(.85,.85))
> leg2 = ax2.legend(loc='upper left', borderaxespad=0,
>   bbox_to_anchor=(.85,.85))
> 

I guess I really just want one legend, so I figured out an alternative
solution:

# alternative to having two legends
ax = plt.subplot(1,1,1)
ax2 = ax.twinx()
lines=  ax.plot([0,1], label='ax1')
lines2= ax2.plot([4,3], 'r--',label='ax2')
lines.extend(lines2)
labels = [l.get_label() for l in lines]
leg = ax.legend(lines, labels)

Is this a reasonable way of achieving the desired result?

thanks,
Paul

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] aligning multiple legends

2010-09-06 Thread Jae-Joon Lee
On Tue, Sep 7, 2010 at 11:04 AM, Paul Ivanov  wrote:
> Is this a reasonable way of achieving the desired result?
>

Yes.
You may take a look at the legend guide.

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

For your original question, it is not possible to do that with the
current legend implementation. However, you may put the legend inside
the AnnotationBbox, which enables this. I'm posting the example for
any future reference.

Regards,

-JJ

# small example
ax = plt.subplot(1,1,1)
ax.plot([0,1], label='ax1')

leg = ax.legend()
ax.legend_ = None # remove the legend from the axes.

ax2 = ax.twinx()
ax2.plot([1,0], 'r--',label='ax2')
leg2 = ax2.legend() # create a legend


# add leg as AnnotationBbox
from matplotlib.offsetbox import AnnotationBbox

leg3 = AnnotationBbox(leg._legend_box, (0, 1),
  xybox=(-5, 0),
  xycoords=leg2.legendPatch,
  boxcoords="offset points",
  box_alignment=(1., 1.), pad=0,
  )
# adjust zorder so that leg3 is drawn after leg2
leg3.zorder = leg2.zorder+0.1

ax2.add_artist(leg3)

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users