show(), the state of the art

Hello.

It is stated that show() should be the last function in a script, as
long as it will stop the execution of the program. Nevertheless, I
have seen that the current behavior is just a pause in the flow, and
it will be restored when the window is closed. The documentation says:

"Many users are frustrated by show because they want it to be a
blocking call that raises the figure, pauses the script until the
figure is closed, and then allows the script to continue running until
the next figure is created and the next show is made.[...]

This is not what show does and unfortunately, because doing blocking
calls across user interfaces can be tricky, is currently unsupported,
though we have made some progress towards supporting blocking events."

My question is: what is the real state of the art of the feature? Is
this something that could be safely exploited, or just an experimental
property not recommended?

I am using Matplotlib v.1.0 and Python 2.5 over Windows XP and TkAgg backend.

Thanks in advance.

Personally I used show() yesterday, and it blocks the execution until
the figure's window is closed. It is of perfect convenience I think,
as a default behavior.

However, I would like to add an option to show() like eg :

show( save_image = True , format = 'eps' )

As it permits to mix the two behavior : interrupt script execution and
let the execution be continued if the user decides so.

I don't know if it's possible, but I would like it be.

Kind regards.

David

2010/11/2 Daπid <davidmenhur@...287...>:

···

Hello.

It is stated that show() should be the last function in a script, as
long as it will stop the execution of the program. Nevertheless, I
have seen that the current behavior is just a pause in the flow, and
it will be restored when the window is closed. The documentation says:

"Many users are frustrated by show because they want it to be a
blocking call that raises the figure, pauses the script until the
figure is closed, and then allows the script to continue running until
the next figure is created and the next show is made.[...]

This is not what show does and unfortunately, because doing blocking
calls across user interfaces can be tricky, is currently unsupported,
though we have made some progress towards supporting blocking events."

My question is: what is the real state of the art of the feature? Is
this something that could be safely exploited, or just an experimental
property not recommended?

I am using Matplotlib v.1.0 and Python 2.5 over Windows XP and TkAgg backend.

Thanks in advance.

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Do you mean this to do what savefig() already does?

Mike

···

On 11/02/2010 07:49 AM, David Kremer wrote:

Personally I used show() yesterday, and it blocks the execution until
the figure's window is closed. It is of perfect convenience I think,
as a default behavior.

However, I would like to add an option to show() like eg :

show( save_image = True , format = 'eps' )
     

--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

2010/11/2 Michael Droettboom <mdroe@...86...>:

···

On 11/02/2010 07:49 AM, David Kremer wrote:

Personally I used show() yesterday, and it blocks the execution until
the figure's window is closed. It is of perfect convenience I think,
as a default behavior.

However, I would like to add an option to show() like eg :

show( save_image = True , format = 'eps' )

Do you mean this to do what savefig() already does?

Mike

Yes sorry I was wrong.

Yes, this is the optimal behavior, but it is not fully implemented, as
seen in the documentation.

···

On Tue, Nov 2, 2010 at 12:49 PM, David Kremer <david.kremer.dk@...287...> wrote:

Personally I used show() yesterday, and it blocks the execution until
the figure's window is closed. It is of perfect convenience I think,
as a default behavior.

I have personally seen significant progress in this area, but there are a few backends that aren’t quite right (MacOSX backend, I believe?). Anyway, some effort was made right before the 1.0.0 release, but it was soon discovered that it was still not right (and even caused some regressions, I believe). So, shortly there-after, a lot of work went into making the behavior more uniform across all backends.

If the show() behavior is currently not working properly for you, I would suggest building from source (if possible) the maintenance v1.0.0 branch which has it mostly right (I believe the only exception is the macosx backend). If that isn’t possible, there have been talks of soon releasing a v1.0.1 package which would contain all of those fixes.

Note, I am not an authority in this matter as I was only just joining the development group at around that time, but I hope this answers your question.

Ben Root

···

On Tue, Nov 2, 2010 at 8:31 AM, Daπid <davidmenhur@…1003…7…> wrote:

On Tue, Nov 2, 2010 at 12:49 PM, David Kremer <david.kremer.dk@gmail.com> wrote:

Personally I used show() yesterday, and it blocks the execution until

the figure’s window is closed. It is of perfect convenience I think,

as a default behavior.

Yes, this is the optimal behavior, but it is not fully implemented, as

seen in the documentation.

I believe multiple uses of ``show`` fail and are expected to fail
for the foreseeable future when using IDLE to run a script.

fwiw,
Alan Isaac

···

On 11/2/2010 10:06 AM, Benjamin Root wrote:

I have personally seen significant progress in this area, but there are a few backends that aren't quite right (MacOSX backend, I believe?).

I have personally seen significant progress in this area, but there are a few backends that aren't quite right (MacOSX backend, I believe?).

I believe multiple uses of ``show`` fail and are expected to fail
for the foreseeable future when using IDLE to run a script.

This may be true in general; the effort has gone, and will continue to go, into getting consistent behavior in ipython and in standalone scripts, not in idle. Nevertheless, the simple test running the attached script with idle on my linux machine (ubuntu 10.10), with mpl from svn, succeeded. This might depend on the default backend, gtkagg in my case.

Eric

multishow.py (283 Bytes)

···

On 11/02/2010 04:39 AM, Alan G Isaac wrote:

On 11/2/2010 10:06 AM, Benjamin Root wrote:

fwiw,
Alan Isaac

As far as I know, show() is working correctly in the MacOSX backend. If you encountered a case where the backend doesn’t do the right thing, can you show a concrete example?

Best,
–Michiel.

···

— On Tue, 11/2/10, Benjamin Root <ben.root@…1304…> wrote:

I
have personally seen significant progress in this area, but there are a
few backends that aren’t quite right (MacOSX backend, I believe?).

Ah, so I must have been confused for something else. I don’t use matplotlib on a mac, so I don’t know for sure. I just could have sworn there was a conversation recently about issues in the macosx backend. I wonder which backend it was that was still troublesome?

Ben Root

···

On Wed, Nov 3, 2010 at 2:19 AM, Michiel de Hoon <mjldehoon@…2652…> wrote:

— On Tue, 11/2/10, Benjamin Root <ben.root@…1304…> wrote:

I
have personally seen significant progress in this area, but there are a
few backends that aren’t quite right (MacOSX backend, I believe?).

As far as I know, show() is working correctly in the MacOSX backend. If you encountered a case where the backend doesn’t do the right thing, can you show a concrete example?

Best,
–Michiel.