creating a multi colored graph with respect to the values in y-axis

2011-06-15 Thread Ravikanth
Hi all,

I am a beginner in python. I need to implement a graph with multiple
colors in it.
In a way, I have a function which varies with respect to time and
amplitude. I have time on x-axis and amplitude on y-axis. Lets say the
amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9,
10-3. I need to plot the graph in such a way that, when the values of
amplitude are in a particular range say 1-3, the color of graph should
be red.
If the amplitude is in the range from 3-5 the graph need to be in
color blue etc..,

Can somebody guide me on this, how to achive this functionality.

Regards,
Ravikanth
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: creating a multi colored graph with respect to the values in y-axis

2011-06-15 Thread Ravikanth
On Jun 15, 10:32 am, Wanderer  wrote:
> On Jun 15, 11:04 am, Ravikanth  wrote:
>
>
>
>
>
> > Hi all,
>
> > I am a beginner in python. I need to implement a graph with multiple
> > colors in it.
> > In a way, I have a function which varies with respect to time and
> > amplitude. I have time on x-axis and amplitude on y-axis. Lets say the
> > amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9,
> > 10-3. I need to plot the graph in such a way that, when the values of
> > amplitude are in a particular range say 1-3, the color of graph should
> > be red.
> > If the amplitude is in the range from 3-5 the graph need to be in
> > color blue etc..,
>
> > Can somebody guide me on this, how to achive this functionality.
>
> > Regards,
> > Ravikanth
>
> Check out the examples in matplotlib.
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...- 
> Hide quoted text -
>
> - Show quoted text -

I did go through the side wanderer.

I wasn't able to figure out the usage of boundaryNorm and
lc.set_array(z) , in that link.
according to my understanding,

cmap = ListedColormap(['r', 'g', 'b'])
norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N)

In the above lines of code, as per my understanding,
Listedcolor map, maps the colors r,g and b to specific indexes into
cmap
i.e cmap(0) represents red,
cmap(1) represents blue
cmap(2) represents green.
for any index greater than 3 a color of blue is returned..

>>> cmap = ListedColormap(['r', 'g', 'b'])
>>> cmap(0)
(1.0, 0.0, 0.0, 1.0)
>>> cmap(1)
(0.0, 0.5, 0.0, 1.0)
>>> cmap(2)
(0.0, 0.0, 1.0, 1.0)
>>> cmap(3)
(0.0, 0.0, 1.0, 1.0)

In this context, I was not able to understand what does boundaryNorm
does.
We have 3 colors and we are using 4 values as argument in boundaryNorm.
[-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to
the values in boundary norm. How is it handled.
Does the function call " lc.set_array(z) " does it ?  what is the
exact use of linecollection.set_array(z) in this context.

Thanks,
Ravikanth
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: creating a multi colored graph with respect to the values in y-axis

2011-06-15 Thread Ravikanth
On Jun 15, 11:57 am, Wanderer  wrote:
> On Jun 15, 12:00 pm, Ravikanth  wrote:
>
>
>
>
>
> > On Jun 15, 10:32 am, Wanderer  wrote:
>
> > > On Jun 15, 11:04 am, Ravikanth  wrote:
>
> > > > Hi all,
>
> > > > I am a beginner in python. I need to implement a graph with multiple
> > > > colors in it.
> > > > In a way, I have a function which varies with respect to time and
> > > > amplitude. I have time on x-axis and amplitude on y-axis. Lets say the
> > > > amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9,
> > > > 10-3. I need to plot the graph in such a way that, when the values of
> > > > amplitude are in a particular range say 1-3, the color of graph should
> > > > be red.
> > > > If the amplitude is in the range from 3-5 the graph need to be in
> > > > color blue etc..,
>
> > > > Can somebody guide me on this, how to achive this functionality.
>
> > > > Regards,
> > > > Ravikanth
>
> > > Check out the examples in matplotlib.
>
> > >http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...quoted
> > > text -
>
> > > - Show quoted text -
>
> > I did go through the side wanderer.
>
> > I wasn't able to figure out the usage of boundaryNorm and
> > lc.set_array(z) , in that link.
> > according to my understanding,
>
> > cmap = ListedColormap(['r', 'g', 'b'])
> > norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N)
>
> > In the above lines of code, as per my understanding,
> > Listedcolor map, maps the colors r,g and b to specific indexes into
> > cmap
> > i.e cmap(0) represents red,
> > cmap(1) represents blue
> > cmap(2) represents green.
> > for any index greater than 3 a color of blue is returned..
>
> > >>> cmap = ListedColormap(['r', 'g', 'b'])
> > >>> cmap(0)
>
> > (1.0, 0.0, 0.0, 1.0)>>> cmap(1)
>
> > (0.0, 0.5, 0.0, 1.0)>>> cmap(2)
>
> > (0.0, 0.0, 1.0, 1.0)>>> cmap(3)
>
> > (0.0, 0.0, 1.0, 1.0)
>
> > In this context, I was not able to understand what does boundaryNorm
> > does.
> > We have 3 colors and we are using 4 values as argument in boundaryNorm.
> > [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to
> > the values in boundary norm. How is it handled.
> > Does the function call " lc.set_array(z) " does it ?  what is the
> > exact use of linecollection.set_array(z) in this context.
>
> > Thanks,
> > Ravikanth
>
> The colors are referring to the slope of the line. Change
> 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to
> understand.  Here are the steps.
>
> 1. Define the functions x,y and z,
> 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap
> 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to
> 1.0) with BoundaryNorm([-1,-0.50, 0.50,1], cmap.N).
>    (Why they add the trailing zero in 0.50 and don't change 1 to 1.0;
> I don't know)
> 4. Create an array of (x,y) points.
> 5. Create a collection of tiny segments [(x1,y1),(x2,y2)] and color
> them with cmap using the boundary rules of norm. lc =
> LineCollection(segments, cmap=cmap, norm=norm)
> 6. Use lc.set_array(y) to determine how to color the segments.
> 7. Plot it.- Hide quoted text -
>
> - Show quoted text -

Hi Wanderer,

Thanks for your help. It works now.
Just wanted to know how to go about when I have to do my color mapping
not only with respect to range of values on y-axis but also based on
some other conditions as well. i.e, say ( range &&  &&
 ) where condition1 could be occurance of some event say,
a flag1 is set true and condition2 may be another flag2 set to false.
Just wanted to use my color mapping not only based on boundaries but
also on occurance of other events as well.
In this context do i have to modify the source of BoundaryNorm in
matplotlib function...?? Can you give me some insights into this.

Regards,
Ravikanth
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: creating a multi colored graph with respect to the values in y-axis

2011-06-15 Thread Ravikanth
On Jun 15, 12:59 pm, Wanderer  wrote:
> On Jun 15, 1:28 pm, Ravikanth  wrote:
>
>
>
>
>
> > On Jun 15, 11:57 am, Wanderer  wrote:
>
> > > On Jun 15, 12:00 pm, Ravikanth  wrote:
>
> > > > On Jun 15, 10:32 am, Wanderer  wrote:
>
> > > > > On Jun 15, 11:04 am, Ravikanth  wrote:
>
> > > > > > Hi all,
>
> > > > > > I am a beginner in python. I need to implement a graph with multiple
> > > > > > colors in it.
> > > > > > In a way, I have a function which varies with respect to time and
> > > > > > amplitude. I have time on x-axis and amplitude on y-axis. Lets say 
> > > > > > the
> > > > > > amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9,
> > > > > > 10-3. I need to plot the graph in such a way that, when the values 
> > > > > > of
> > > > > > amplitude are in a particular range say 1-3, the color of graph 
> > > > > > should
> > > > > > be red.
> > > > > > If the amplitude is in the range from 3-5 the graph need to be in
> > > > > > color blue etc..,
>
> > > > > > Can somebody guide me on this, how to achive this functionality.
>
> > > > > > Regards,
> > > > > > Ravikanth
>
> > > > > Check out the examples in matplotlib.
>
> > > > >http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...-
>
> > > > > - Show quoted text -
>
> > > > I did go through the side wanderer.
>
> > > > I wasn't able to figure out the usage of boundaryNorm and
> > > > lc.set_array(z) , in that link.
> > > > according to my understanding,
>
> > > > cmap = ListedColormap(['r', 'g', 'b'])
> > > > norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N)
>
> > > > In the above lines of code, as per my understanding,
> > > > Listedcolor map, maps the colors r,g and b to specific indexes into
> > > > cmap
> > > > i.e cmap(0) represents red,
> > > > cmap(1) represents blue
> > > > cmap(2) represents green.
> > > > for any index greater than 3 a color of blue is returned..
>
> > > > >>> cmap = ListedColormap(['r', 'g', 'b'])
> > > > >>> cmap(0)
>
> > > > (1.0, 0.0, 0.0, 1.0)>>> cmap(1)
>
> > > > (0.0, 0.5, 0.0, 1.0)>>> cmap(2)
>
> > > > (0.0, 0.0, 1.0, 1.0)>>> cmap(3)
>
> > > > (0.0, 0.0, 1.0, 1.0)
>
> > > > In this context, I was not able to understand what does boundaryNorm
> > > > does.
> > > > We have 3 colors and we are using 4 values as argument in boundaryNorm.
> > > > [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to
> > > > the values in boundary norm. How is it handled.
> > > > Does the function call " lc.set_array(z) " does it ?  what is the
> > > > exact use of linecollection.set_array(z) in this context.
>
> > > > Thanks,
> > > > Ravikanth
>
> > > The colors are referring to the slope of the line. Change
> > > 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to
> > > understand.  Here are the steps.
>
> > > 1. Define the functions x,y and z,
> > > 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap
> > > 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to
> > > 1.0) with BoundaryNorm([-1,-0.50, 0.50,1], cmap.N).
> > >    (Why they add the trailing zero in 0.50 and don't change 1 to 1.0;
> > > I don't know)
> > > 4. Create an array of (x,y) points.
> > > 5. Create a collection of tiny segments [(x1,y1),(x2,y2)] and color
> > > them with cmap using the boundary rules of norm. lc =
> > > LineCollection(segments, cmap=cmap, norm=norm)
> > > 6. Use lc.set_array(y) to determine how to color the segments.
> > > 7. Plot it.- Hide quoted text -
>
> > > - Show quoted text -
>
> > Hi Wanderer,
>
> > Thanks for your help. It works now.
> > Just wanted to know how to go about when I have to do my color mapping
> > not only with respect to range of values on y-axis but also based on
> > some other conditions as well. i.e, say ( range &&  &&
> >  ) where condition1 could be occurance of some event say,
> > a flag1 is set true and condition2 may be another flag2 set to false.
> > Just wanted to use my color mapping not only based on boundaries but
> > also on occurance of other events as well.
> > In this context do i have to modify the source of BoundaryNorm in
> > matplotlib function...?? Can you give me some insights into this.
>
> > Regards,
> > Ravikanth
>
> I don't know if there is another way, but I think changing the
> lc.set_array input would be the easiest. Each point has an (x,y,z)
> where z determines the color by what range it is in. You would use
> your conditions to set points in z to the desired color.- Hide quoted text -
>
> - Show quoted text -

does (x,y,z) mean adding another dimension 'z' (which is to be used as
a condition) to the step 4) as suggested in the steps outlined to me
before ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: creating a multi colored graph with respect to the values in y-axis

2011-06-15 Thread Ravikanth
On Jun 15, 1:59 pm, Wanderer  wrote:
> On Jun 15, 2:10 pm, Ravikanth  wrote:
>
>
>
>
>
> > On Jun 15, 12:59 pm, Wanderer  wrote:
>
> > > On Jun 15, 1:28 pm, Ravikanth  wrote:
>
> > > > On Jun 15, 11:57 am, Wanderer  wrote:
>
> > > > > On Jun 15, 12:00 pm, Ravikanth  wrote:
>
> > > > > > On Jun 15, 10:32 am, Wanderer  wrote:
>
> > > > > > > On Jun 15, 11:04 am, Ravikanth  wrote:
>
> > > > > > > > Hi all,
>
> > > > > > > > I am a beginner in python. I need to implement a graph with 
> > > > > > > > multiple
> > > > > > > > colors in it.
> > > > > > > > In a way, I have a function which varies with respect to time 
> > > > > > > > and
> > > > > > > > amplitude. I have time on x-axis and amplitude on y-axis. Lets 
> > > > > > > > say the
> > > > > > > > amplitude of the graph is divided into 4 ranges, say 
> > > > > > > > 1-3,3-5,5-9,
> > > > > > > > 10-3. I need to plot the graph in such a way that, when the 
> > > > > > > > values of
> > > > > > > > amplitude are in a particular range say 1-3, the color of graph 
> > > > > > > > should
> > > > > > > > be red.
> > > > > > > > If the amplitude is in the range from 3-5 the graph need to be 
> > > > > > > > in
> > > > > > > > color blue etc..,
>
> > > > > > > > Can somebody guide me on this, how to achive this functionality.
>
> > > > > > > > Regards,
> > > > > > > > Ravikanth
>
> > > > > > > Check out the examples in matplotlib.
>
> > > > > > >http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...
>
> > > > > > > - Show quoted text -
>
> > > > > > I did go through the side wanderer.
>
> > > > > > I wasn't able to figure out the usage of boundaryNorm and
> > > > > > lc.set_array(z) , in that link.
> > > > > > according to my understanding,
>
> > > > > > cmap = ListedColormap(['r', 'g', 'b'])
> > > > > > norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N)
>
> > > > > > In the above lines of code, as per my understanding,
> > > > > > Listedcolor map, maps the colors r,g and b to specific indexes into
> > > > > > cmap
> > > > > > i.e cmap(0) represents red,
> > > > > > cmap(1) represents blue
> > > > > > cmap(2) represents green.
> > > > > > for any index greater than 3 a color of blue is returned..
>
> > > > > > >>> cmap = ListedColormap(['r', 'g', 'b'])
> > > > > > >>> cmap(0)
>
> > > > > > (1.0, 0.0, 0.0, 1.0)>>> cmap(1)
>
> > > > > > (0.0, 0.5, 0.0, 1.0)>>> cmap(2)
>
> > > > > > (0.0, 0.0, 1.0, 1.0)>>> cmap(3)
>
> > > > > > (0.0, 0.0, 1.0, 1.0)
>
> > > > > > In this context, I was not able to understand what does boundaryNorm
> > > > > > does.
> > > > > > We have 3 colors and we are using 4 values as argument in 
> > > > > > boundaryNorm.
> > > > > > [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped 
> > > > > > to
> > > > > > the values in boundary norm. How is it handled.
> > > > > > Does the function call " lc.set_array(z) " does it ?  what is the
> > > > > > exact use of linecollection.set_array(z) in this context.
>
> > > > > > Thanks,
> > > > > > Ravikanth
>
> > > > > The colors are referring to the slope of the line. Change
> > > > > 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to
> > > > > understand.  Here are the steps.
>
> > > > > 1. Define the functions x,y and z,
> > > > > 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap
> > > > > 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to
> > > > > 1.0) with BoundaryNorm([-1,-0.50

trouble creating tooltips using Wx in Tk canvas

2011-07-06 Thread Ravikanth
Hi all,
Hi all,

I am having a trouble creating tooltips. I am trying to embed a
matplotlib graph inside  a TkInter canvas. After some search over the
net, I found out a way to create tooltips using the WXbackend.
But when I embed my matplotlib figure inside a Tk and  the tooltips
are not getting displayed.
The error I am getting is below.

Traceback (most recent call last):
  File "U:\graphing_tool\plotinsideTkInter\plotInTk.py", line 12, in

tooltip = wx.ToolTip(tip='tip with a long %s line and a newline\n'
% (' '*100)) # needs to be added to getover the bug with tooltip.
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py",
line 771, in __init__
_misc_.ToolTip_swiginit(self,_misc_.new_ToolTip(*args, **kwargs))
PyNoAppError: The wx.App object must be created first!

I am not able to figure out the reason. I am trying to use IDLE for
running the script using python 2.7. I tried running from commandline
as well but still i face the same error. Following is the piece of
code I have used.
I created a simple 'sin' wave using matplotlib. and a  button. Added
them to a TkFrame.
and then binded the code using

self.f.canvas.mpl_connect('motion_notify_event',_onMotion)

to '_onMotion' function, where I am printing the toooltip.

Can somebody please help me solving the issue.

Code I have used is below.

#!/usr/apps/Python/bin/python
import matplotlib, sys
matplotlib.use('WXAgg')
matplotlib.interactive(False)
import numpy as np
from numpy import arange, sin, pi
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import wx
import Tkinter
tooltip = wx.ToolTip(tip='tip with a long %s line and a newline\n' %
(' '*100))
 # needs to be added to getover the bug with tooltip.

def alt():
print 'My Button'

def _onMotion(event):
print "Xvalue:",event.xdata," Yvalue:",event.ydata
tip= "Xvalue:{0}, Yvalue: {1}".format(event.xdata,event.ydata)
tooltip.SetTip(tip)
tooltip.Enable(True)

class  myClass(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
#global _onMotion
self.parent=parent

self.buildFigure()

def buildFigure(self):

self.f=plt.figure()
self.f = plt.figure(figsize=(5,4))
self.a = self.f.add_subplot(111)
self.t =
np.array([0.01,0.02,0.03,0.04,0.05,0.07,0.09,1.7,1.9,2.3,2.5,2.7,2.9])
self.s = sin(2*pi*self.t)
self.a.plot(self.t,self.s)


self.dataPlot = FigureCanvasTkAgg(self.f, master=self)
self.f.canvas.mpl_connect('motion_notify_event',_onMotion)
self.dataPlot.get_tk_widget().pack(side='top', fill='both')
self.toolbar = NavigationToolbar2TkAgg( self.dataPlot, self )
self.toolbar.update()
self.toolbar.pack()


self.btn=Tkinter.Button(self, text='btton',command=alt)
self.btn.pack(ipadx=250)

def alt (self):
print 9

if __name__ == "__main__":
app = myClass(None)
app.title('Embedding in Tk')
app.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: trouble creating tooltips using Wx in Tk canvas

2011-07-06 Thread Ravikanth
On Jul 6, 1:32 pm, Ian Kelly  wrote:
> On Wed, Jul 6, 2011 at 9:12 AM, Ravikanth  wrote:
> > Hi all,
> > Hi all,
>
> > I am having a trouble creating tooltips. I am trying to embed a
> > matplotlib graph inside  a TkInter canvas. After some search over the
> > net, I found out a way to create tooltips using the WXbackend.
> > But when I embed my matplotlib figure inside a Tk and  the tooltips
> > are not getting displayed.
>
> That's pretty much what I would expect, since wxPython and Tkinter are
> completely different GUI libraries.  Trying to use them together is a
> bit like trying to call a .NET function from Java -- maybe possible,
> but it's going to take a lot of work.
>
> > The error I am getting is below.
>
> > Traceback (most recent call last):
> >  File "U:\graphing_tool\plotinsideTkInter\plotInTk.py", line 12, in
> > 
> >    tooltip = wx.ToolTip(tip='tip with a long %s line and a newline\n'
> > % (' '*100)) # needs to be added to getover the bug with tooltip.
> >  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py",
> > line 771, in __init__
> >    _misc_.ToolTip_swiginit(self,_misc_.new_ToolTip(*args, **kwargs))
> > PyNoAppError: The wx.App object must be created first!
>
> > I am not able to figure out the reason.
>
> As it says, you haven't created the wx.App object necessary for pretty
> much all wxPython code.  You could create one, but your tooltip still
> would not work correctly because you would be running the Tkinter
> event loop rather than the wxPython event loop.  If you want to use
> the wxToolTip widget, then you should write your program to use
> wxPython only.  Alternatively, googling for "tkinter tooltip" turns up
> a couple of recipes; you could try one of those.
>
> Cheers,
> Ian

Thank you Ian for your insights to me on this.
I will migrate to wxPython to achieve the functionality.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2011-07-06 Thread Ravikanth
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()'
-- 
http://mail.python.org/mailman/listinfo/python-list


multiple call to show not working in matplotlib

2011-07-06 Thread Ravikanth
Hi,

I am facing some problem. I have made multiple calls to show()
function in a sinlge program. as below. Before the first call I
plotted x vs y . then i called show. execution halted until i closed
the window. Once I closed the window, execution again progressed and
even passed second show(), but the dispaly did not appear.

Can anyone please suggest me how to go about solving this issue.


from pylab import *
from matplotlib import pyplot as p
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 border'
x=arange(10)
y=sin(x)
ax.plot(x,y)
show()
print 'passed the second show'


Thanks
Ravikanth
-- 
http://mail.python.org/mailman/listinfo/python-list


multiple calls to show doesnot work for matplotlib

2011-07-06 Thread Ravikanth
Hi,

I am facing some problem. I have made multiple calls to show()
function in a sinlge program. as below. Before the first call I
plotted x vs y . then i called show. execution halted until i closed
the window. Once I closed the window, execution again progressed and
even passed second show(), but the dispaly did not appear.

Can anyone please suggest me how to go about solving this issue.


from pylab import *
from matplotlib import pyplot as p
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 border'
x=arange(10)
y=sin(x)
ax.plot(x,y)
show()
print 'passed the second show'


Thanks
Ravikanth
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiple calls to show doesnot work for matplotlib

2011-07-06 Thread Ravikanth
On Jul 6, 6:15 pm, Steven D'Aprano  wrote:
> Ravikanth wrote:
> > Hi,
>
> > I am facing some problem.
>
> Yes, we heard you the first two times, there's no need to keep repeating the
> question over and over again.
>
> There is no Service Level Agreement for guaranteed response times for free
> advice over the Internet. Be patient, and hopefully somebody with an answer
> to your question will respond once they have read the question. Wait AT
> LEAST a day before reposting the question.
>
> In the meantime, you might like to Read the Fine Manual, which explains
> everything you need to know about using show().
>
> http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show
>
> Does that answer your question?
>
> --
> Steven

Hi Steven,

I do understand that posting several times causes trouble. I did not
see my post appear on the groups over in the groups site even after
like 15 mints after posting. I thought I was posting it incorrectly.

Thank you for your link. I will look through it.
Regards,
Ravikanth
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2011-07-06 Thread Ravikanth
On Jul 6, 6:26 pm, Robert Kern  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/listinfo/matplotlib-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/faq/howto_faq.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
-- 
http://mail.python.org/mailman/listinfo/python-list