help me to understand please

Friends,
In the following. I am not able to understand how this plot.show() works. I have commented the problem in the following examples.

plt.plot(x,y,‘b-’)
[<matplotlib.lines.Line2D object at 0x9e50ecc>]
plt.show() # shows the plot of x Vs y
plt.ylim( (1.5,4.5) )
(1.5, 4.5)
plt.show() # Does nt show the plot
plt.ylim( ymin=1.5,ymax=4.5 )
(1.5, 4.5)
plt.show() # Does nt show the plot

Thanks,
Bala

You have to call plt.show() only when you want to actually show the
figure. That's because you're using python command interpreter.

Try:

plt.plot(x,y,'b-')
plt.ylim( (1.5,4.5) )
plt.show()

If you want to do interactive plotting, I suggest using ipython.

ipython -pylab

already import the pylab module, that provide all the pyplot functions.

I prefer to do something like

$ipython

  import matplotlib.pyplot as plt
  plt.ion() # incase it's not already in interactive mode
  <do my printing>

This way, it will open the figure window and you'll be able to
"decorate" the plot in the ipython shell and see the result applied to
the "background" figure with no need to execute "plt.show()" or close
the windows between a command and a "show()".

Regards,

···

On Sat, Mar 28, 2009 at 15:45, Bala subramanian <bala.biophysics@...287...> wrote:

Friends,
In the following. I am not able to understand how this plot.show() works. I
have commented the problem in the following examples.

--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi