Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > show() in pylab doesn't work if used twice

Reply
Thread Tools

show() in pylab doesn't work if used twice

 
 
Ravikanth
Guest
Posts: n/a
 
      07-06-2011
Hi all,

I have been using python for just over a month now.
I am writing a program to plot some graph using the show() twice in
the same program. The code snippet is shown below.
I am trying to plot a simple x vs y using ax.plot() then I get a
figure displayed. I close the figure displayed and then the execution
proceeds. Now If i try to call show second time with the updated
values of x and y, the second figure does not appear on my desktop.
but the second call to show() appears to work as the code also printed
'passed the second show' as well
Can someone help me figure out what the problem here is.why is the
second figure not coming up on the desktop.

I am using python 2.7 .




from pylab import *
import scipy
import pylab as pl
import matplotlib.pyplot as plt
fig=pl.figure()
ax=fig.add_subplot(111)
x=arange(10)
y=x*2
ax.plot(x,y)
show()


print 'passed the first show()'
x=arange(10)
y=sin(x)
ax.plot(x,y)
show()
print 'passed the second show()'
 
Reply With Quote
 
 
 
 
Robert Kern
Guest
Posts: n/a
 
      07-06-2011
On 7/6/11 5:05 PM, Ravikanth wrote:
> Hi all,
>
> I have been using python for just over a month now.
> I am writing a program to plot some graph using the show() twice in
> the same program. The code snippet is shown below.


Please use the matplotlib-users list for matplotlib questions. By the way, four
versions of your message made it to this list. I'm sure the repetition was an
honest mistake, but there may be things you can do to prevent it in the future.

https://lists.sourceforge.net/lists/...tplotlib-users

To answer your question, you are probably using an older version of matplotlib
than 1.0.0. The ability to use show() more than once was only added in 1.0.0:

http://matplotlib.sourceforge.net/fa....html#use-show

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

 
Reply With Quote
 
 
 
 
Ravikanth
Guest
Posts: n/a
 
      07-07-2011
On Jul 6, 6:26*pm, Robert Kern <(E-Mail Removed)> wrote:
> On 7/6/11 5:05 PM, Ravikanth wrote:
>
> > Hi all,

>
> > I have been using python for just over a month now.
> > I am writing a program to plot some graph using the *show() twice in
> > the same program. The code snippet is shown below.

>
> Please use the matplotlib-users list for matplotlib questions. By the way, four
> versions of your message made it to this list. I'm sure the repetition was an
> honest mistake, but there may be things you can do to prevent it in the future.
>
> * *https://lists.sourceforge.net/lists/...tplotlib-users
>
> To answer your question, you are probably using an older version of matplotlib
> than 1.0.0. The ability to use show() more than once was only added in 1.0.0:
>
> * *http://matplotlib.sourceforge.net/fa....html#use-show
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
> * that is made terrible by our own mad attempt to interpret it as though it had
> * an underlying truth."
> * *-- Umberto Eco


Hi Robert,


Thank you for the link.

I did not see my post posted onto the groups after i sent my query,
which usually does happen in a few minutes. So I thought i posted it
wrongly and reposted it. My apologies for inconvenience.
I'll make sure this does not repeat.


Regards,
Ravikanth
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
twice(twice(x)) Kiuhnm C++ 2 04-01-2006 04:41 PM
Is there a better interactive plotter then pylab? Charles Krug Python 2 04-28-2005 02:31 AM
pylab strange error message ajikoe@gmail.com Python 0 04-22-2005 09:43 AM
MatPlotLib.MatLab troubles (how to install/run matplotlib.PyLab?) Dr. Colombes Python 3 02-23-2005 04:32 PM
problem with import pylab from a website jean.rossier@epfl.ch Python 1 01-19-2005 01:55 PM



Advertisments