[Matplotlib-users] Rabinovich...

2015-05-30 Thread Prahas David Nafissian
Hello,

My latest fractal music video, made with
MatPlotLib.

Enjoy!

--Prahas

https://www.youtube.com/watch?v=kh6ZLvpWr5kfeature=youtu.be

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib.backends.backend_gtk3cairo memory leak

2015-05-26 Thread David
Hi, I seem to have a memory leak while generating a 'live' plot display. This
wasn't the case for GTK2, but the example below is consuming ~800k/second
(Matplotlib 1.4.3, PyGI aio-3.14.0_rev18, Windows 7 x64, python 3.4.3). I
have checked the garbage collector but it doesn't show anything interesting
(no massive incrementing count of uncollected items). Anyway, I would be
very grateful if somebody could confirm and/or fix this (or tell me what I'm
doing wrong).Many thanksDavidCode below:
from gi.repository import Gtk, Gdk, GLibfrom matplotlib.figure import
Figure# Tell matplotlib to use a GTK canvas for drawing#from
matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as
FigureCanvasfrom matplotlib.backends.backend_gtk3cairo import
FigureCanvasGTK3Cairo as FigureCanvas# Application Classclass
pyMatPlotLibTest(object):def update_gui(self):y = [self.index] *
1024self.index += 1if self.index  1024: self.index = 0   
Gdk.threads_enter()self.line.set_ydata(y)   
self.axes.set_title(%d % self.index)self.canvas.draw()   
Gdk.threads_leave()return Truedef __init__(self):   
self.index = 0self.x = range(1024)# Initialise the
threads system and allow threads to work with GTKGLib.threads_init()
   
# Draw scopeself.figure = Figure(dpi=100)self.canvas =
FigureCanvas(self.figure)  # a Gtk.DrawingArea   
#self.widget.alignment_ScopeDisplay.add(self.canvas)# Draw initial
scopeself.axes = self.figure.add_subplot(111)self.line, =
self.axes.plot(self.x, [0]* 1024)self.axes.set_title(None)   
self.axes.set_xbound(0.0, 1024)self.axes.set_ybound(-16, 1040)   
self.window_main = Gtk.Window(title=pyMatPlotLibTest)   
self.window_main.connect(destroy, lambda x: Gtk.main_quit())   
self.window_main.add(self.canvas)self.window_main.show_all()   
# Ticker for the update of the input state monitoring   
Gdk.threads_add_timeout(priority = GLib.PRIORITY_DEFAULT_IDLE,  
 
interval = 10, # msecfunction =
self.update_gui)Gtk.main()if __name__ == __main__:gui =
pyMatPlotLibTest()




--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/matplotlib-backends-backend-gtk3cairo-memory-leak-tp45614.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib.backends.backend_gtk3cairo memory leak

2015-05-26 Thread David Hughes
I removed all calls to threads and swapped Gdk.threads_add_timeout to 
Glib.timeout_add (See attached. However if I comment the call to 
self.canvas.draw(), the python memory utilisation sits at 30.8Mb.


from gi.repository import Gtk, Gdk, GLib


from matplotlib.figure import Figure
# Tell matplotlib to use a GTK canvas for drawing
#from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as 
FigureCanvas
from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as 
FigureCanvas


# Application Class
class pyMatPlotLibTest(object):

def update_gui(self):
y = [self.index] * 1024

self.index += 1
if self.index  1024: self.index = 0

#Gdk.threads_enter()
self.line.set_ydata(y)
self.axes.set_title(%d % self.index)
self.canvas.draw()
#Gdk.threads_leave()

return True

def __init__(self):
self.index = 0
self.x = range(1024)

# Initialise the threads system and allow threads to work with GTK
#GLib.threads_init()

# Draw scope
self.figure = Figure(dpi=100)
self.canvas = FigureCanvas(self.figure)  # a Gtk.DrawingArea
#self.widget.alignment_ScopeDisplay.add(self.canvas)

# Draw initial scope
self.axes = self.figure.add_subplot(111)
self.line, = self.axes.plot(self.x, [0]* 1024)
self.axes.set_title(None)
self.axes.set_xbound(0.0, 1024)
self.axes.set_ybound(-16, 1040)

self.window_main = Gtk.Window(title=pyMatPlotLibTest)
self.window_main.connect(destroy, lambda x: Gtk.main_quit())
self.window_main.add(self.canvas)
self.window_main.show_all()

# Ticker for the update of the input state monitoring
GLib.timeout_add(10, self.update_gui)
#Gdk.threads_add_timeout(priority = GLib.PRIORITY_DEFAULT_IDLE,
#interval = 10, # msec
#function = self.update_gui)
Gtk.main()


if __name__ == __main__:
gui = pyMatPlotLibTest()

From: ben.v.r...@gmail.com [mailto:ben.v.r...@gmail.com] On Behalf Of Benjamin 
Root
Sent: 26 May 2015 14:53
To: David Hughes
Cc: Matplotlib Users
Subject: Re: [Matplotlib-users] matplotlib.backends.backend_gtk3cairo memory 
leak

I take it that it doesn't happen using the GTK3Agg backend? What about the 
threading portion? Does it happen if you take the threading out?
Ben Root

On Tue, May 26, 2015 at 8:23 AM, David 
dhug...@rapiscansystems.commailto:dhug...@rapiscansystems.com wrote:
Hi, I seem to have a memory leak while generating a 'live' plot display. This 
wasn't the case for GTK2, but the example below is consuming ~800k/second 
(Matplotlib 1.4.3, PyGI aio-3.14.0_rev18, Windows 7 x64, python 3.4.3). I have 
checked the garbage collector but it doesn't show anything interesting (no 
massive incrementing count of uncollected items). Anyway, I would be very 
grateful if somebody could confirm and/or fix this (or tell me what I'm doing 
wrong). Many thanks David Code below:

from gi.repository import Gtk, Gdk, GLib





from matplotlib.figure import Figure

# Tell matplotlib to use a GTK canvas for drawing

#from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as 
FigureCanvas

from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as 
FigureCanvas





# Application Class

class pyMatPlotLibTest(object):



def update_gui(self):

y = [self.index] * 1024



self.index += 1

if self.index  1024: self.index = 0



Gdk.threads_enter()

self.line.set_ydata(y)

self.axes.set_title(%d % self.index)

self.canvas.draw()

Gdk.threads_leave()



return True



def __init__(self):

self.index = 0

self.x = range(1024)



# Initialise the threads system and allow threads to work with GTK

GLib.threads_init()



# Draw scope

self.figure = Figure(dpi=100)

self.canvas = FigureCanvas(self.figure)  # a Gtk.DrawingArea

#self.widget.alignment_ScopeDisplay.add(self.canvas)



# Draw initial scope

self.axes = self.figure.add_subplot(111)

self.line, = self.axes.plot(self.x, [0]* 1024)

self.axes.set_title(None)

self.axes.set_xbound(0.0, 1024)

self.axes.set_ybound(-16, 1040)



self.window_main = Gtk.Window(title=pyMatPlotLibTest)

self.window_main.connect(destroy, lambda x: Gtk.main_quit())

self.window_main.add(self.canvas)

self.window_main.show_all()



# Ticker for the update of the input state monitoring

Gdk.threads_add_timeout(priority = GLib.PRIORITY_DEFAULT_IDLE,

interval = 10, # msec

function = self.update_gui)

Gtk.main()





if __name__ == __main__:

gui = pyMatPlotLibTest()


View

Re: [Matplotlib-users] matplotlib.backends.backend_gtk3cairo memory leak

2015-05-26 Thread David
  I take it that it doesn't happen using the GTK3Agg backend?
GTK3Agg is unimplemented at the GTK3-end:

  File
c:\Python34\lib\site-packages\matplotlib\backends\backend_gtk3agg.py, line
69, in on_draw_event
buf, cairo.FORMAT_ARGB32, width, height)
NotImplementedError: Surface.create_for_data: Not Implemented yet.

 What about the threading portion? Does it happen if you take the threading
 out?
I removed all calls to threads and swapped Gdk.threads_add_timeout to
Glib.timeout_add. This made little difference.

However if I comment the call to self.canvas.draw(), the python memory
utilisation sits at 30.8Mb (but the graph does not update of course).

Thanks

David




--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/matplotlib-backends-backend-gtk3cairo-memory-leak-tp45614p45616.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib.backends.backend_gtk3cairo memory leak

2015-05-26 Thread David Hughes
Thanks, however GTK3Agg is unimplemented in at the GTK3-end:

  File c:\Python34\lib\site-packages\matplotlib\backends\backend_gtk3agg.py, 
line 69, in on_draw_event
buf, cairo.FORMAT_ARGB32, width, height)
NotImplementedError: Surface.create_for_data: Not Implemented yet.

Regards

David

From: ben.v.r...@gmail.com [mailto:ben.v.r...@gmail.com] On Behalf Of Benjamin 
Root
Sent: 26 May 2015 14:53
To: David Hughes
Cc: Matplotlib Users
Subject: Re: [Matplotlib-users] matplotlib.backends.backend_gtk3cairo memory 
leak

I take it that it doesn't happen using the GTK3Agg backend? What about the 
threading portion? Does it happen if you take the threading out?
Ben Root

On Tue, May 26, 2015 at 8:23 AM, David 
dhug...@rapiscansystems.commailto:dhug...@rapiscansystems.com wrote:
Hi, I seem to have a memory leak while generating a 'live' plot display. This 
wasn't the case for GTK2, but the example below is consuming ~800k/second 
(Matplotlib 1.4.3, PyGI aio-3.14.0_rev18, Windows 7 x64, python 3.4.3). I have 
checked the garbage collector but it doesn't show anything interesting (no 
massive incrementing count of uncollected items). Anyway, I would be very 
grateful if somebody could confirm and/or fix this (or tell me what I'm doing 
wrong). Many thanks David Code below:

from gi.repository import Gtk, Gdk, GLib





from matplotlib.figure import Figure

# Tell matplotlib to use a GTK canvas for drawing

#from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as 
FigureCanvas

from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as 
FigureCanvas





# Application Class

class pyMatPlotLibTest(object):



def update_gui(self):

y = [self.index] * 1024



self.index += 1

if self.index  1024: self.index = 0



Gdk.threads_enter()

self.line.set_ydata(y)

self.axes.set_title(%d % self.index)

self.canvas.draw()

Gdk.threads_leave()



return True



def __init__(self):

self.index = 0

self.x = range(1024)



# Initialise the threads system and allow threads to work with GTK

GLib.threads_init()



# Draw scope

self.figure = Figure(dpi=100)

self.canvas = FigureCanvas(self.figure)  # a Gtk.DrawingArea

#self.widget.alignment_ScopeDisplay.add(self.canvas)



# Draw initial scope

self.axes = self.figure.add_subplot(111)

self.line, = self.axes.plot(self.x, [0]* 1024)

self.axes.set_title(None)

self.axes.set_xbound(0.0, 1024)

self.axes.set_ybound(-16, 1040)



self.window_main = Gtk.Window(title=pyMatPlotLibTest)

self.window_main.connect(destroy, lambda x: Gtk.main_quit())

self.window_main.add(self.canvas)

self.window_main.show_all()



# Ticker for the update of the input state monitoring

Gdk.threads_add_timeout(priority = GLib.PRIORITY_DEFAULT_IDLE,

interval = 10, # msec

function = self.update_gui)

Gtk.main()





if __name__ == __main__:

gui = pyMatPlotLibTest()


View this message in context: matplotlib.backends.backend_gtk3cairo memory 
leakhttp://matplotlib.1069221.n5.nabble.com/matplotlib-backends-backend-gtk3cairo-memory-leak-tp45614.html
Sent from the matplotlib - users mailing list 
archivehttp://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html at 
Nabble.com.

--
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.netmailto:Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Lorenz: A Composition

2015-04-01 Thread Prahas David Nafissian
Hi,

For a little right brain diversion, here's what I created
using matplotlib:

https://www.youtube.com/watch?v=gWkFnPHbHokfeature=youtu.be

Enjoy!

--Prahas
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Set a 3-D point?

2015-03-30 Thread Prahas David Nafissian
Hi,

For those of you following the trials and tribulations of moi,
I hacked the solution.  The assignment is:

x0 = [ [-1.0,0.0,0.5] ]

I printed the orig x0.  Printed mine.  Noticed mine was missing
a set of brackets.  Tried it.  Success!

--Prahas




On Sun, Mar 29, 2015 at 10:07 AM, Prahas David Nafissian 
prahas.mu...@gmail.com wrote:


 Hi Mat-Plotters,

 I'm trying to modify the below code so that I can
 set the initial conditions to (-1,0,0.5).

 The code below randomly sets the initial conditions:

 **

 # I changed the equation -- it's not Lorenz.

 N_trajectories = 1

 def lorentz_deriv((x, y, z), t0, aa=1.1, yy=0.87):
 Compute the time-derivative of a Lorentz system.
 return [y*(z-1+x*x)+yy*x, x*(3*z+1-x*x)+yy*y, -2*z*(aa+x*y)]

 # Choose random starting points, uniformly distributed from -15 to 15

 np.random.seed(1)

 *# Here's the statement which assigns the initial conditions:*

 x0 = -15 + 30 * np.random.random((N_trajectories, 3))

 **

 I tried simply doing this:

 x0 = (-1,0,0.5)

 but I get this error:

 ValueError: need more than 1 value to unpack


 What am I missing?  What is the correct way to make the assignment?


 Thanks!


 --Prahas





--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Set a 3-D point?

2015-03-29 Thread Prahas David Nafissian
Hi Mat-Plotters,

I'm trying to modify the below code so that I can
set the initial conditions to (-1,0,0.5).

The code below randomly sets the initial conditions:

**

# I changed the equation -- it's not Lorenz.

N_trajectories = 1

def lorentz_deriv((x, y, z), t0, aa=1.1, yy=0.87):
Compute the time-derivative of a Lorentz system.
return [y*(z-1+x*x)+yy*x, x*(3*z+1-x*x)+yy*y, -2*z*(aa+x*y)]

# Choose random starting points, uniformly distributed from -15 to 15

np.random.seed(1)

*# Here's the statement which assigns the initial conditions:*

x0 = -15 + 30 * np.random.random((N_trajectories, 3))

**

I tried simply doing this:

x0 = (-1,0,0.5)

but I get this error:

ValueError: need more than 1 value to unpack


What am I missing?  What is the correct way to make the assignment?


Thanks!


--Prahas
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Lorenz -- another Q

2015-03-11 Thread Prahas David Nafissian
Hi,

Given the Lorenz code shared yesterday, is there a way
to generate a log file of the x,y,z points generated?

Thanks in advance.

--Prahas

In case you deleted the code:


import numpy as np
from scipy import integrate

from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import cnames
from matplotlib import animation

# orig value of N_traj was 20 -- very cool this way.

N_trajectories = 1

def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0):
Compute the time-derivative of a Lorentz system.
return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z]

# Choose random starting points, uniformly distributed from -15 to 15

np.random.seed(1)

# changing from -15,30 to 10,5 below starts the drawing in the middle,
# rather than getting the long line from below
# if using N_Traj  1, return to orig values.

# x0 = -15 + 30 * np.random.random((N_trajectories, 3))

x0 = 10 + 5 * np.random.random((N_trajectories, 3))


# Solve for the trajectories

# orig values:  0,4,1000
# 3rd value -- lower it, it gets choppier.
# 2nd value -- increase it -- more points, but speedier.

# change middle num from 4 to 15 -- this adds points

t = np.linspace(0, 40, 3000)
x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t)
  for x0i in x0])

# Set up figure  3D axis for animation
fig = plt.figure()
ax = fig.add_axes([0, 0, 1, 1], projection='3d')

# changing off to on below adds axises.  slows it down but you
# can fix that with interval value in the animation call

ax.axis('on')

# choose a different color for each trajectory
colors = plt.cm.jet(np.linspace(0, 1, N_trajectories))

# set up lines and points -- this is a correction from
# the orig jake code.  the next four lines...

lines = [ax.plot([], [], [], '-', c=c)[0]
for c in colors]
pts = [ax.plot([], [], [], 'o', c=c)[0]
for c in colors]

# prepare the axes limits
ax.set_xlim((-25, 25))
ax.set_ylim((-35, 35))
ax.set_zlim((5, 55))

# set point-of-view: specified by (altitude degrees, azimuth degrees)
ax.view_init(30, 0)

# initialization function: plot the background of each frame
def init():
for line, pt in zip(lines, pts):
line.set_data([], [])
line.set_3d_properties([])

pt.set_data([], [])
pt.set_3d_properties([])
return lines + pts

# animation function.  This will be called sequentially with the frame number
def animate(i):
# we'll step two time-steps per frame.  This leads to nice results.

i = (2 * i) % x_t.shape[1]

for line, pt, xi in zip(lines, pts, x_t):
x, y, z = xi[:i].T
line.set_data(x, y)
line.set_3d_properties(z)

pt.set_data(x[-1:], y[-1:])
pt.set_3d_properties(z[-1:])

# changed 0.3 to 0.05 below -- this slows the rotation of the view.
# changed 30 to 20 below
# changing 20 to (20 + (.1 * i)) rotates on the Z axis.  trippy.

ax.view_init(10, 0.1 * i)
# ax.view_init(10, 100)
fig.canvas.draw()
return lines + pts

# instantiate the animator.  I've deleted the blit switch (for Mac)
# enlarging frames=500 works now -- it failed before because I didn't give it
# enough data -- by changing the t=np.linspace line above I generate
more points.
# interval larger slows it down
# changed inteval from 30 to 200, frames from 500 to 3000

anim = animation.FuncAnimation(fig, animate, init_func=init,
   frames=3000, interval=200)

# Save as mp4. This requires mplayer or ffmpeg to be installed. COMPLEX!
# Instead, use a screen record program:  Quicktime on the Mac; MS
Expression Encoder on PC.
# anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec',
'libx264'])

plt.show()

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Lorenz -- another Q

2015-03-11 Thread Prahas David Nafissian
Hello,

Solved the write issue.

I tried numpy savetxt but it chokes on 3D arrays.

So I'm doing this:

x_t.tofile('test3.txt',sep= ,format=%f)

Only issue -- no end-of-lines. But I can write a quick
Pascal program to fix this...

Once again, thanks!

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Lorenz - solution

2015-03-10 Thread Prahas David Nafissian
I think you need to ask Jake Vanderplas -- the code
is all his!  See the link in the email to get to his blog...

Thanks again!




On Tue, Mar 10, 2015 at 8:49 AM, Benjamin Root ben.r...@ou.edu wrote:
 +1000!!

 Great job! Would you mind if I clean it up a bit and add it to the
 mplot3d/animation gallery? Full credit, of course.


 On Tue, Mar 10, 2015 at 11:30 AM, Prahas David Nafissian
 prahas.mu...@gmail.com wrote:

 Friends,

 I thought you'd like to see the solution.

 Many thanks to Jake Vanderplas for his code and teachings:


 https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/

 If you start a new IP Notebook session, run as your first entry:

 %pylab

 and then copy and paste the text below and run it, you should be good to
 go
 (on a Mac, at least).

 There are several parameters I've changed from his original, and I've
 commented as I've changed.  The original code is at the link above.

 There is one error in his code -- I've documented it below.

 Again, thanks to the community, Jake, and Ben Root.

 --Prahas

 **

 import numpy as np
 from scipy import integrate

 from matplotlib import pyplot as plt
 from mpl_toolkits.mplot3d import Axes3D
 from matplotlib.colors import cnames
 from matplotlib import animation

 # orig value of N_traj was 20 -- very cool this way.

 N_trajectories = 1

 def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0):
 Compute the time-derivative of a Lorentz system.
 return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z]

 # Choose random starting points, uniformly distributed from -15 to 15

 np.random.seed(1)

 # changing from -15,30 to 10,5 below starts the drawing in the middle,
 # rather than getting the long line from below
 # if using N_Traj  1, return to orig values.

 # x0 = -15 + 30 * np.random.random((N_trajectories, 3))

 x0 = 10 + 5 * np.random.random((N_trajectories, 3))


 # Solve for the trajectories

 # orig values:  0,4,1000
 # 3rd value -- lower it, it gets choppier.
 # 2nd value -- increase it -- more points, but speedier.

 # change middle num from 4 to 15 -- this adds points

 t = np.linspace(0, 40, 3000)
 x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t)
   for x0i in x0])

 # Set up figure  3D axis for animation
 fig = plt.figure()
 ax = fig.add_axes([0, 0, 1, 1], projection='3d')

 # changing off to on below adds axises.  slows it down but you
 # can fix that with interval value in the animation call

 ax.axis('on')

 # choose a different color for each trajectory
 colors = plt.cm.jet(np.linspace(0, 1, N_trajectories))

 # set up lines and points -- this is a correction from
 # the orig jake code.  the next four lines...

 lines = [ax.plot([], [], [], '-', c=c)[0]
 for c in colors]
 pts = [ax.plot([], [], [], 'o', c=c)[0]
 for c in colors]

 # prepare the axes limits
 ax.set_xlim((-25, 25))
 ax.set_ylim((-35, 35))
 ax.set_zlim((5, 55))

 # set point-of-view: specified by (altitude degrees, azimuth degrees)
 ax.view_init(30, 0)

 # initialization function: plot the background of each frame
 def init():
 for line, pt in zip(lines, pts):
 line.set_data([], [])
 line.set_3d_properties([])

 pt.set_data([], [])
 pt.set_3d_properties([])
 return lines + pts

 # animation function.  This will be called sequentially with the frame
 number
 def animate(i):
 # we'll step two time-steps per frame.  This leads to nice results.

 i = (2 * i) % x_t.shape[1]

 for line, pt, xi in zip(lines, pts, x_t):
 x, y, z = xi[:i].T
 line.set_data(x, y)
 line.set_3d_properties(z)

 pt.set_data(x[-1:], y[-1:])
 pt.set_3d_properties(z[-1:])

 # changed 0.3 to 0.05 below -- this slows the rotation of the
 view.
 # changed 30 to 20 below
 # changing 20 to (20 + (.1 * i)) rotates on the Z axis.  trippy.

 ax.view_init(10, 0.1 * i)
 # ax.view_init(10, 100)
 fig.canvas.draw()
 return lines + pts

 # instantiate the animator.  I've deleted the blit switch (for Mac)
 # enlarging frames=500 works now -- it failed before because I didn't give
 it
 # enough data -- by changing the t=np.linspace line above I generate
 more points.
 # interval larger slows it down
 # changed inteval from 30 to 200, frames from 500 to 3000

 anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=3000, interval=200)

 # Save as mp4. This requires mplayer or ffmpeg to be installed.
 COMPLEX!
 # Instead, use a screen record program:  Quicktime on the Mac; MS
 Expression Encoder on PC.
 # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec',
 'libx264'])

 plt.show()

 


 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership

Re: [Matplotlib-users] Lorenz - solution

2015-03-10 Thread Prahas David Nafissian
@ Adam -- thanks!

@ Everyone:  given the Lorenz code shared, is there a way
to generate a log file of the x,y,z points generated?

Thanks in advance.

--Prahas




On Tue, Mar 10, 2015 at 8:59 AM, Adam Hughes hughesada...@gmail.com wrote:
 That's pretty swag!

 On Tue, Mar 10, 2015 at 11:49 AM, Benjamin Root ben.r...@ou.edu wrote:

 +1000!!

 Great job! Would you mind if I clean it up a bit and add it to the
 mplot3d/animation gallery? Full credit, of course.


 On Tue, Mar 10, 2015 at 11:30 AM, Prahas David Nafissian
 prahas.mu...@gmail.com wrote:

 Friends,

 I thought you'd like to see the solution.

 Many thanks to Jake Vanderplas for his code and teachings:


 https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/

 If you start a new IP Notebook session, run as your first entry:

 %pylab

 and then copy and paste the text below and run it, you should be good to
 go
 (on a Mac, at least).

 There are several parameters I've changed from his original, and I've
 commented as I've changed.  The original code is at the link above.

 There is one error in his code -- I've documented it below.

 Again, thanks to the community, Jake, and Ben Root.

 --Prahas

 **

 import numpy as np
 from scipy import integrate

 from matplotlib import pyplot as plt
 from mpl_toolkits.mplot3d import Axes3D
 from matplotlib.colors import cnames
 from matplotlib import animation

 # orig value of N_traj was 20 -- very cool this way.

 N_trajectories = 1

 def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0):
 Compute the time-derivative of a Lorentz system.
 return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z]

 # Choose random starting points, uniformly distributed from -15 to 15

 np.random.seed(1)

 # changing from -15,30 to 10,5 below starts the drawing in the middle,
 # rather than getting the long line from below
 # if using N_Traj  1, return to orig values.

 # x0 = -15 + 30 * np.random.random((N_trajectories, 3))

 x0 = 10 + 5 * np.random.random((N_trajectories, 3))


 # Solve for the trajectories

 # orig values:  0,4,1000
 # 3rd value -- lower it, it gets choppier.
 # 2nd value -- increase it -- more points, but speedier.

 # change middle num from 4 to 15 -- this adds points

 t = np.linspace(0, 40, 3000)
 x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t)
   for x0i in x0])

 # Set up figure  3D axis for animation
 fig = plt.figure()
 ax = fig.add_axes([0, 0, 1, 1], projection='3d')

 # changing off to on below adds axises.  slows it down but you
 # can fix that with interval value in the animation call

 ax.axis('on')

 # choose a different color for each trajectory
 colors = plt.cm.jet(np.linspace(0, 1, N_trajectories))

 # set up lines and points -- this is a correction from
 # the orig jake code.  the next four lines...

 lines = [ax.plot([], [], [], '-', c=c)[0]
 for c in colors]
 pts = [ax.plot([], [], [], 'o', c=c)[0]
 for c in colors]

 # prepare the axes limits
 ax.set_xlim((-25, 25))
 ax.set_ylim((-35, 35))
 ax.set_zlim((5, 55))

 # set point-of-view: specified by (altitude degrees, azimuth degrees)
 ax.view_init(30, 0)

 # initialization function: plot the background of each frame
 def init():
 for line, pt in zip(lines, pts):
 line.set_data([], [])
 line.set_3d_properties([])

 pt.set_data([], [])
 pt.set_3d_properties([])
 return lines + pts

 # animation function.  This will be called sequentially with the frame
 number
 def animate(i):
 # we'll step two time-steps per frame.  This leads to nice results.

 i = (2 * i) % x_t.shape[1]

 for line, pt, xi in zip(lines, pts, x_t):
 x, y, z = xi[:i].T
 line.set_data(x, y)
 line.set_3d_properties(z)

 pt.set_data(x[-1:], y[-1:])
 pt.set_3d_properties(z[-1:])

 # changed 0.3 to 0.05 below -- this slows the rotation of the
 view.
 # changed 30 to 20 below
 # changing 20 to (20 + (.1 * i)) rotates on the Z axis.  trippy.

 ax.view_init(10, 0.1 * i)
 # ax.view_init(10, 100)
 fig.canvas.draw()
 return lines + pts

 # instantiate the animator.  I've deleted the blit switch (for Mac)
 # enlarging frames=500 works now -- it failed before because I didn't
 give it
 # enough data -- by changing the t=np.linspace line above I generate
 more points.
 # interval larger slows it down
 # changed inteval from 30 to 200, frames from 500 to 3000

 anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=3000, interval=200)

 # Save as mp4. This requires mplayer or ffmpeg to be installed.
 COMPLEX!
 # Instead, use a screen record program:  Quicktime on the Mac; MS
 Expression Encoder on PC.
 # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec',
 'libx264'])

 plt.show

[Matplotlib-users] Lorenz - solution

2015-03-10 Thread Prahas David Nafissian
Friends,

I thought you'd like to see the solution.

Many thanks to Jake Vanderplas for his code and teachings:

https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/

If you start a new IP Notebook session, run as your first entry:

%pylab

and then copy and paste the text below and run it, you should be good to go
(on a Mac, at least).

There are several parameters I've changed from his original, and I've
commented as I've changed.  The original code is at the link above.

There is one error in his code -- I've documented it below.

Again, thanks to the community, Jake, and Ben Root.

--Prahas

**

import numpy as np
from scipy import integrate

from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import cnames
from matplotlib import animation

# orig value of N_traj was 20 -- very cool this way.

N_trajectories = 1

def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0):
Compute the time-derivative of a Lorentz system.
return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z]

# Choose random starting points, uniformly distributed from -15 to 15

np.random.seed(1)

# changing from -15,30 to 10,5 below starts the drawing in the middle,
# rather than getting the long line from below
# if using N_Traj  1, return to orig values.

# x0 = -15 + 30 * np.random.random((N_trajectories, 3))

x0 = 10 + 5 * np.random.random((N_trajectories, 3))


# Solve for the trajectories

# orig values:  0,4,1000
# 3rd value -- lower it, it gets choppier.
# 2nd value -- increase it -- more points, but speedier.

# change middle num from 4 to 15 -- this adds points

t = np.linspace(0, 40, 3000)
x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t)
  for x0i in x0])

# Set up figure  3D axis for animation
fig = plt.figure()
ax = fig.add_axes([0, 0, 1, 1], projection='3d')

# changing off to on below adds axises.  slows it down but you
# can fix that with interval value in the animation call

ax.axis('on')

# choose a different color for each trajectory
colors = plt.cm.jet(np.linspace(0, 1, N_trajectories))

# set up lines and points -- this is a correction from
# the orig jake code.  the next four lines...

lines = [ax.plot([], [], [], '-', c=c)[0]
for c in colors]
pts = [ax.plot([], [], [], 'o', c=c)[0]
for c in colors]

# prepare the axes limits
ax.set_xlim((-25, 25))
ax.set_ylim((-35, 35))
ax.set_zlim((5, 55))

# set point-of-view: specified by (altitude degrees, azimuth degrees)
ax.view_init(30, 0)

# initialization function: plot the background of each frame
def init():
for line, pt in zip(lines, pts):
line.set_data([], [])
line.set_3d_properties([])

pt.set_data([], [])
pt.set_3d_properties([])
return lines + pts

# animation function.  This will be called sequentially with the frame number
def animate(i):
# we'll step two time-steps per frame.  This leads to nice results.

i = (2 * i) % x_t.shape[1]

for line, pt, xi in zip(lines, pts, x_t):
x, y, z = xi[:i].T
line.set_data(x, y)
line.set_3d_properties(z)

pt.set_data(x[-1:], y[-1:])
pt.set_3d_properties(z[-1:])

# changed 0.3 to 0.05 below -- this slows the rotation of the view.
# changed 30 to 20 below
# changing 20 to (20 + (.1 * i)) rotates on the Z axis.  trippy.

ax.view_init(10, 0.1 * i)
# ax.view_init(10, 100)
fig.canvas.draw()
return lines + pts

# instantiate the animator.  I've deleted the blit switch (for Mac)
# enlarging frames=500 works now -- it failed before because I didn't give it
# enough data -- by changing the t=np.linspace line above I generate
more points.
# interval larger slows it down
# changed inteval from 30 to 200, frames from 500 to 3000

anim = animation.FuncAnimation(fig, animate, init_func=init,
   frames=3000, interval=200)

# Save as mp4. This requires mplayer or ffmpeg to be installed. COMPLEX!
# Instead, use a screen record program:  Quicktime on the Mac; MS
Expression Encoder on PC.
# anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec',
'libx264'])

plt.show()



--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Newbie Q re: Lorenz attractor

2015-03-09 Thread Prahas David Nafissian
Dear Ben, Amit, and Ryan,

Thanks so much for your input!  Looking forward to
finding the time to give it a go!

Best,

--Prahas


On Sun, Mar 8, 2015 at 7:14 PM, Benjamin Root ben.r...@ou.edu wrote:
 Yes, absolutely it will work... so long as you do not use blitting. Blitting
 for mplot3d is pretty much useless anyway (I think draws of the axes occur
 anyway regardless of the blit mode), but it is also broken for the macosx
 backend, anyway.

 Cheers!
 Ben Root

 On Sun, Mar 8, 2015 at 8:59 PM, Amit Saha amitsaha...@gmail.com wrote:

 On Mon, Mar 9, 2015 at 7:31 AM, Prahas David Nafissian
 prahas.mu...@gmail.com wrote:
  Hi,
 
  I want to create an animation of the Lorenz attractor,
  plotting each new point as it is generated by the
  equations.  So we see the graph being drawn
  over time.

 You will very likely need to use the animation API for this. I
 recently tried to demonstrate the Henon function in a fashion that it
 appears I am drawing it over time:
 https://www.youtube.com/watch?v=76ll818RlpQ

 You can see the code linked from there:

 https://github.com/amitsaha/playground/blob/master/recipes/henon_animation.py

 That might give you a starting point of what you are trying to do.

 
  Also, as it is being drawn, I want to be able to
  rotate the screen in 3 dimensions.

 Sorry, nothing much I can add here.

 Best,
 Amit.

 --
 http://echorand.me


 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for
 all
 things parallel software development, from weekly thought leadership blogs
 to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Newbie Q re: Lorenz attractor

2015-03-08 Thread Prahas David Nafissian
Hi,

I want to create an animation of the Lorenz attractor,
plotting each new point as it is generated by the
equations.  So we see the graph being drawn
over time.

Also, as it is being drawn, I want to be able to
rotate the screen in 3 dimensions.

Will MatPlot do this on a Mac (10.8.5)?

Thanks!

PS -- here is code using MatPlot to create the full Lorenz:

http://matplotlib.org/examples/mplot3d/lorenz_attractor.html

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Get contourf image as array

2014-10-16 Thread David Hoese
Thanks Ben. I'll take a look through the archive.

On 10/16/14, 9:43 AM, Benjamin Root wrote:
 What you are looking for is called rasterization. Matplotlib does this
 deep within the codebase and is not accessible (believe me, I tried).
 However, there have been other discussions in this mailing list about
 how to use GDAL to rasterize a set of polygons (represented as paths),
 including some links to stack-overflow questions. It isn't a complete
 end-to-end solution, but the pieces are there.

 Cheers!
 Ben Root


 On Wed, Oct 15, 2014 at 2:09 PM, David Hoese dho...@gmail.com
 mailto:dho...@gmail.com wrote:

 For the first question, if I save the figure (as a PNG I'm guessing,
 unless you can save into a more array-like format), I'd have to make
 sure that there were no labels or ticks and that the axes fit the whole
 figure. I'd also have to get the dpi and size information correct, but I
 suppose it would be possible that way. I was hoping for something a
 little easier and in-memory. This might be the simplest answer the more
 I think about it.

 If I'm starting from the paths, I'd still have to write them to the
 grid array. I thought maybe the backend could do that and I magically
 get the image.

 I'll look in to using savefig and getting the data out.

 -Dave

 On 10/15/14, 12:42 PM, Joy merwin monteiro wrote:
  pardon the query if it seems dumb, but why don't you do a savefig()
  after plotting the data and then convert it to any format you like?
 
  alternatively, contour() and contourf() both create paths that can
  be accessed:
 
  cf = contourf(.)
 
  output = cf.collections.pop()
  paths = output.get_paths()[i] # for the various contours
 
  the x,y coordinates can then be accessed as
 
  xcoords = paths.vertices.transpose()[0]
  ycoords = paths.vertices.transpose()[1]
 
  you can then do whatever you wish with them.
 
  Joy
 
 
  On Wed, Oct 15, 2014 at 9:11 PM, David Hoese dho...@gmail.com 
 mailto:dho...@gmail.com
   mailto:dho...@gmail.com mailto:dho...@gmail.com wrote:
  
   I've been searching and reading through source code and
 google searches
   to see if this is possible, but no luck so far. I'm basically
 trying to
   map some data using Basemap, use contourf to map it to an
 image, and
   then put that image in a geotiff (or other format) for use in
 other GIS
   programs. I have other tools for remapping data and creating
 geotiffs,
   but the contour image looks better. All I would need to get
 this to work
   would be an array representing the image inside the axes of a
 contourf
   plot. I found a lot of geotiff - Basemap png results, but I
 would like
   the reverse.
  
   Since the plots are made using paths/patches I'm guessing I
 would have
   to have a backend render the image and then extract the image
 somehow.
   Does anyone have some tips or tricks to do something like
 this? Or am I
   thinking about this completely wrong?
  
   Thanks for any help and if you could CC me in any replies it
 would be
   much appreciated.
  
   -Dave
  
  
   
 --
   Comprehensive Server Monitoring with Site24x7.
   Monitor 10 servers for $9/Month.
   Get alerted through email, SMS, voice calls or mobile push
   notifications.
   Take corrective actions from your mobile device.
   http://p.sf.net/sfu/Zoho
   ___
   Matplotlib-users mailing list
   Matplotlib-users@lists.sourceforge.net
 mailto:Matplotlib-users@lists.sourceforge.net
   mailto:Matplotlib-users@lists.sourceforge.net
 mailto:Matplotlib-users@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
  
  
  
   --
   The best ruler, when he finishes his
   tasks and completes his affairs,
   the people say
   “It all happened naturally”
  
 - Te Tao Ch'ing

 
 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push
 notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 mailto:Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

[Matplotlib-users] Get contourf image as array

2014-10-15 Thread David Hoese
I've been searching and reading through source code and google searches 
to see if this is possible, but no luck so far. I'm basically trying to 
map some data using Basemap, use contourf to map it to an image, and 
then put that image in a geotiff (or other format) for use in other GIS 
programs. I have other tools for remapping data and creating geotiffs, 
but the contour image looks better. All I would need to get this to work 
would be an array representing the image inside the axes of a contourf 
plot. I found a lot of geotiff - Basemap png results, but I would like 
the reverse.

Since the plots are made using paths/patches I'm guessing I would have 
to have a backend render the image and then extract the image somehow. 
Does anyone have some tips or tricks to do something like this? Or am I 
thinking about this completely wrong?

Thanks for any help and if you could CC me in any replies it would be 
much appreciated.

-Dave

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Get contourf image as array

2014-10-15 Thread David Hoese
For the first question, if I save the figure (as a PNG I'm guessing, 
unless you can save into a more array-like format), I'd have to make 
sure that there were no labels or ticks and that the axes fit the whole 
figure. I'd also have to get the dpi and size information correct, but I 
suppose it would be possible that way. I was hoping for something a 
little easier and in-memory. This might be the simplest answer the more 
I think about it.

If I'm starting from the paths, I'd still have to write them to the 
grid array. I thought maybe the backend could do that and I magically 
get the image.

I'll look in to using savefig and getting the data out.

-Dave

On 10/15/14, 12:42 PM, Joy merwin monteiro wrote:
 pardon the query if it seems dumb, but why don't you do a savefig()
 after plotting the data and then convert it to any format you like?

 alternatively, contour() and contourf() both create paths that can
 be accessed:

 cf = contourf(.)

 output = cf.collections.pop()
 paths = output.get_paths()[i] # for the various contours

 the x,y coordinates can then be accessed as

 xcoords = paths.vertices.transpose()[0]
 ycoords = paths.vertices.transpose()[1]

 you can then do whatever you wish with them.

 Joy


 On Wed, Oct 15, 2014 at 9:11 PM, David Hoese dho...@gmail.com
 mailto:dho...@gmail.com wrote:

 I've been searching and reading through source code and google searches
 to see if this is possible, but no luck so far. I'm basically trying to
 map some data using Basemap, use contourf to map it to an image, and
 then put that image in a geotiff (or other format) for use in other GIS
 programs. I have other tools for remapping data and creating geotiffs,
 but the contour image looks better. All I would need to get this to work
 would be an array representing the image inside the axes of a contourf
 plot. I found a lot of geotiff - Basemap png results, but I would like
 the reverse.

 Since the plots are made using paths/patches I'm guessing I would have
 to have a backend render the image and then extract the image somehow.
 Does anyone have some tips or tricks to do something like this? Or am I
 thinking about this completely wrong?

 Thanks for any help and if you could CC me in any replies it would be
 much appreciated.

 -Dave

 
 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push
 notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 mailto:Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 The best ruler, when he finishes his
 tasks and completes his affairs,
 the people say
 “It all happened naturally”

   - Te Tao Ch'ing

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Scientific Python introduction

2014-09-04 Thread David Pine
NumPy, SciPy, MatPlotLib Users  Science teachers:

I have written an introduction to scientific python that you may find useful.  
You can download it from GitHub and use it freely:

https://github.com/djpine/pyman

I wrote this manual/book for undergraduates taking science and engineering 
courses that use programming to solve science and engineering problems.  It is 
not for experts.  I am sharing it with the hope that others may find it useful. 
 It includes an introduction to very basic programming, numpy, matplotlib,  
scipy, as well as instructions on how to download and install Python and these 
three libraries.  It also includes an introduction to IPython notebooks.

Corrections and suggestions for improvements are welcome.

David Pine--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] PGF backend

2013-11-20 Thread David Kremer
 Hello !

I would like to have some hints about the matplotlib usage, especially
the PGF/tikz backend.

I use a latex document, and almost only tikz figures.

I have a couple of problems with the matplotlib package.

The first is the preemptive behaviour of the matplotlib package over the
used fonts. I would like the text to be let as it, without adding
stuff like \sffamily\ttffont, and so on.

For example, if I write $L^2$ as a legend axis, I want this text to be
let as it, without any modification by the pgf backend.

A second point, is that I would like to not use the
\begin{pgffigure}\end{pgffigure}, the \makeatletter and fancy stuff like
that. I want to take care myself of the latex code. Is it possible ?

Finally, Would it be possible to specify the size of the graphic
somewhere ? The documentation is rather vague about it.

Thank you for help.


--
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Problem with matplotlib under aix 6.1

2013-09-25 Thread David Roman
hello,

Sorry for my poor english.

I have a big problem with matplotlib under AIX6.1.

My configuration :

OS : AIX 6.1
XLC : 12.1.0.0
Python 2.7.5-1

I installed Python and all dependencies from www.oss4aix.org/download/RPMS with 
the rpm files.
This is the all packages that I installed:
rpm -ivh gcc/libgcc-4.4.7-1.aix6.1.ppc.rpm
rpm -ivh libffi/libffi-3.0.13-1.aix5.1.ppc.rpm
rpm -ivh libffi/libffi-devel-3.0.13-1.aix5.1.ppc.rpm
rpm -ivh expat/expat-2.1.0-1.aix5.1.ppc.rpm
rpm -ivh expat/expat-devel-2.1.0-1.aix5.1.ppc.rpm
rpm -ivh libiconv/libiconv-1.14-2.aix5.1.ppc.rpm 
glib2/glib2-2.36.3-1.aix5.1.ppc.rpm gettext/gettext-0.17-1.aix5.1.ppc.rpm 
--nodeps (missing libxlsmp.a(smprt.o))
rpm -ivh pkg-config/pkg-config-0.28-1.aix5.1.ppc.rpm
rpm -ivh zlib/zlib-1.2.8-1.aix5.1.ppc.rpm
rpm -ivh zlib/zlib-devel-1.2.8-1.aix5.1.ppc.rpm
rpm -ivh libpng/libpng-1.6.3-1.aix5.1.ppc.rpm
rpm -ivh libpng/libpng-devel-1.6.3-1.aix5.1.ppc.rpm
rpm -ivh freetype2/freetype2-2.5.0-1.aix5.1.ppc.rpm
rpm -ivh freetype2/freetype2-devel-2.5.0-1.aix5.1.ppc.rpm
rpm -ivh fontconfig/fontconfig-2.8.0-2.aix5.1.ppc.rpm
rpm -ivh fontconfig/fontconfig-devel-2.8.0-2.aix5.1.ppc.rpm
rpm -ivh libXrender/libXrender-0.9.7-2.aix6.1.ppc.rpm
rpm -ivh libXrender/libXrender-devel-0.9.7-2.aix6.1.ppc.rpm
rpm -ivh libXft/libXft-2.3.1-1.aix5.1.ppc.rpm
rpm -ivh libXft/libXft-devel-2.3.1-1.aix5.1.ppc.rpm
rpm -Uvh tcl/tcl-8.5.14-1.aix5.1.ppc.rpm
rpm -ivh tcl/tcl-devel-8.5.14-1.aix5.1.ppc.rpm
rpm -Uvh tk/tk-8.5.14-1.aix5.1.ppc.rpm
rpm -ivh tk/tk-devel-8.5.14-1.aix5.1.ppc.rpm
rpm -ivh info/info-5.1-1.aix5.1.ppc.rpm
rpm -ivh readline/readline-6.2-4.aix5.1.ppc.rpm
rpm -ivh readline/readline-devel-6.2-4.aix5.1.ppc.rpm
rpm -ivh openssl/openssl-1.0.1e-2.aix5.1.ppc.rpm
rpm -ivh openssl/openssl-devel-1.0.1e-2.aix5.1.ppc.rpm
rpm -ivh gdbm/gdbm-1.10-1.aix5.1.ppc.rpm
rpm -ivh gdbm/gdbm-devel-1.10-1.aix5.1.ppc.rpm
rpm -ivh gmp/gmp-5.0.5-1.aix5.1.ppc.rpm
rpm -ivh gmp/gmp-devel-5.0.5-1.aix5.1.ppc.rpm
rpm -ivh gettext/gettext-devel-0.17-1.aix5.1.ppc.rpm
rpm -ivh db4/db4-4.7.25-2.aix5.1.ppc.rpm
rpm -ivh db4/db4-devel-4.7.25-2.aix5.1.ppc.rpm
rpm -ivh bzip2/bzip2-1.0.6-1.aix5.1.ppc.rpm
rpm -ivh bzip2/bzip2-devel-1.0.6-1.aix5.1.ppc.rpm
rpm -ivh sqlite/sqlite-3.7.17-1.aix5.1.ppc.rpm
rpm -ivh sqlite/sqlite-devel-3.7.17-1.aix5.1.ppc.rpm
rpm -ivh python/python-libs-2.7.5-1.aix6.1.ppc.rpm
rpm -ivh python/python-2.7.5-1.aix6.1.ppc.rpm
rpm -ivh python/python-devel-2.7.5-1.aix6.1.ppc.rpm
rpm -ivh python/tkinter-2.7.5-1.aix6.1.ppc.rpm
rpm -ivh python/python-tools-2.7.5-1.aix6.1.ppc.rpm
rpm -ivh python/python-test-2.7.5-1.aix6.1.ppc.rpm

In the first step I spent a lot of time to compile matplotlib. This is what I 
did to install matplotlib :

From sources I installed NUMPY, SETUPTOOLS,  PYTHON-DATEUTIL

With easy_install I installed  TORNADO, PYPARSING



I need to do some changes in sources of matplotlib:

Patch 0
--- CXX/WrapPython.h2013-09-18 14:47:26.0 -0500
+++ CXX/WrapPython.h.orig   2013-09-18 14:47:07.0 -0500
@@ -38,9 +38,6 @@
  #ifndef __PyCXX_wrap_python_hxx__
  #define __PyCXX_wrap_python_hxx__

- #includestdio.h
- #includeunistd.h
-
  // On some platforms we have to include time.h to get select defined
  #if !defined(__WIN32__)  !defined(WIN32)  !defined(_WIN32)  
!defined(_WIN64)
  #include sys/time.h


Patch 1
--- src/ft2font.h   2013-09-18 14:43:11.0 -0500
+++ src/ft2font.h.orig  2013-09-18 14:42:19.0 -0500
@@ -1,9 +1,5 @@
 /* -*- mode: c++; c-basic-offset: 4 -*- */

- #includestdio.h
- #includeunistd.h
-
-
  /* A python interface to freetype2 */
  #ifndef _FT2FONT_H
  #define _FT2FONT_H

Patch 2
--- src/mplutils.h  2013-09-18 14:46:06.0 -0500
+++ src/mplutils.h.orig 2013-09-18 14:45:32.0 -0500
@@ -12,9 +12,6 @@
   *
   */

- #includestdio.h
- #includeunistd.h
-
  #ifndef _MPLUTILS_H
  #define _MPLUTILS_H


Patch 3
--- ttconv/pprdrv.h 2013-09-18 14:49:07.0 -0500
+++ ttconv/pprdrv.h.orig2013-09-18 14:48:47.0 -0500
@@ -21,9 +21,6 @@
  ** This file last revised 5 December 1995.
  */

- #includestdio.h
- #includeunistd.h
-
  #include vector
  #include cassert



I create a link in the sources directory  : ln -s 
/opt/freeware/lib/python2.7/config Modules

I create a xlC script
cat  xlC  EOF
/bin/bash
Modules/ld_so_aix
EOF
chmod a+x xlC

python setup.py install


With all this, the compilation ends.

When I check the use of matplotlib

import matplotlib
import numpy as np
from matplotlib import pyplot
a=np.arange(100)
pyplot.plot(a)

At this point I'm so happy !!

BUT, when I want plot the array 
pyplot.show()

I had a segmentation fault .. HELP !


My first question : Do somebody  is able to plot something with matplotlib uner 
AIX 6.1  And HOW ???

Do you know a howtodo page to do a correct installation ?

Thank you !


David
--
October Webinars: Code for Performance
Free Intel webinars can

[Matplotlib-users] v.0.99.1.1 DeprecationWarning: Use the new widget gtk.Tooltip() self.tooltips = gtk.Tooltips()

2013-07-03 Thread David Jonathan Pryce Morris
I am new to python and when using Matplotlib 0.99.1.1 [Scientific Linux
6.3, Python 2.6] to plot I get the following error:

/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py:621: 
DeprecationWarning: Use the new widget gtk.Tooltip
  self.tooltips = gtk.Tooltips()

This is when the program reaches:

plt.show()

Where plt is the matplotlib.pyplot. Prior to this point of the code I am
able to produce pdf files of the figure by using plt.savefig(fname).

Reading other online comments I have tried to update Matplotlib. First I
installed the dependences via

sudo yum-builddep python-matplotlib

Then:

sudo yum install matplotlib

This then tells me that I have the latest version of matplotlib and
therefore does nothing. There are more recent versions available from
the Matplotlib website. I tried to install the latest version after
unpacking the tar.gz file. After using the command:

sudo python setup.py install

I get the message below ending with error: 

command 'gcc' failed with exit status 1

Can anyone suggest a way to install the latest matplotlib or stop the
message I get with using plt.show()?

Jonathan





basedirlist is: ['/usr/local', '/usr', 'usr/lib64']

BUILDING MATPLOTLIB
matplotlib: 1.2.1
python: 2.6.6 (r266:84292, Jun 18 2012, 09:57:52)  [GCC
4.4.6 20110731 (Red Hat 4.4.6-3)]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.4.1
 freetype2: 9.22.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.49
   Tkinter: Tkinter: 73770, Tk: 8.5, Tcl: 8.5
* Guessing the library and include directories
for
* Tcl and Tk because the tclConfig.sh and
* tkConfig.sh could not be found and/or parsed.
  Gtk+: gtk+: 2.18.9, glib: 2.22.5, pygtk: 2.16.0,
pygobject: 2.20.0
   Mac OS X native: no
Qt: no
   Qt4: Qt: 4.6.2, PyQt4: 4.7.4
PySide: no
 Cairo: 1.8.6

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  dateutil: 1.4.1
  pytz: 2010h

OPTIONAL USETEX DEPENDENCIES
dvipng: no
   ghostscript: 8.70
 latex: 3.141592
   pdftops: 0.12.4

[Edit setup.cfg to suppress the above messages]

pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends',
'matplotlib.backends.qt4_editor', 'matplotlib.projections',
'matplotlib.testing', 'matplotlib.testing.jpl_units',
'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d',
'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1',
'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.tri',
'matplotlib.delaunay']
running install
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -
build/lib.linux-x86_64-2.6/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._backend_agg' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC
-fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
-DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include
-Iusr/lib64/include -Iusr/lib64/python2.6/include
-Iusr/lib64/python2.6/site-packages/include
-I/usr/lib64/python2.6/site-packages/numpy/core/include
-I/usr/local/include -I/usr/include -I.
-I/usr/lib64/python2.6/site-packages/numpy/core/include -Isrc
-Iagg24/include -I.
-I/usr/lib64/python2.6/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I.
-I/usr/include/python2.6 -c agg24/src/agg_trans_affine.cpp -o
build/temp.linux-x86_64-2.6/agg24/src/agg_trans_affine.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC
-fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
-DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include
-Iusr/lib64/include -Iusr/lib64/python2.6/include
-Iusr/lib64/python2.6/site-packages/include
-I/usr/lib64/python2.6/site-packages/numpy/core/include
-I/usr/local/include -I/usr/include -I.
-I/usr/lib64/python2.6/site-packages/numpy/core/include -Isrc
-Iagg24/include -I.
-I/usr/lib64/python2.6/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I.
-I/usr/include/python2.6 

Re: [Matplotlib-users] Matplotlib-users Digest, Vol 82, Issue 16

2013-03-11 Thread David Hoese
You likely need to show() the canvas. I usually do this by calling 
fig.canvas.show() before the for loop.
Since you are using a Qt4 backend the canvas used by the figure is a 
QWidget, the basic component of a Qt4 GUI. I don't know if there is a 
more matplotlib specific way of doing this, but when dealing with a 
larger system this is how I do it.

I would also add a sleep (from time import sleep) of a couple seconds 
for testing to make sure you are getting through the entire for loop 
before you can see it.

Please CC in any replies, thanks.

-Dave

On 3/11/13 8:58 AM, ndbeck...@gmail.com wrote:
 I want to update a plot in real time.  I did some goog search, and saw various
 answers.  Trouble is, they aren't working.

 Here's a typical example:

 import matplotlib.pyplot as plt
 import numpy as np
 fig=plt.figure()
 plt.axis([0,1000,0,1])

 i=0
 x=list()
 y=list()

 while i 1000:
  temp_y=np.random.random()
  x.append(i)
  y.append(temp_y)
  plt.scatter(i,temp_y)
  i+=1
  plt.draw()

 If I run this, it draws nothing.

 This is my matplotlibrc:
 backend : Qt4Agg
 mathtext.fontset: stix


--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] real time plotting

2013-03-11 Thread David Hoese
Oops forgot to change the subject line.

On 3/11/13 9:34 AM, David Hoese wrote:
 You likely need to show() the canvas. I usually do this by calling 
 fig.canvas.show() before the for loop.
 Since you are using a Qt4 backend the canvas used by the figure is a 
 QWidget, the basic component of a Qt4 GUI. I don't know if there is a 
 more matplotlib specific way of doing this, but when dealing with a 
 larger system this is how I do it.

 I would also add a sleep (from time import sleep) of a couple 
 seconds for testing to make sure you are getting through the entire 
 for loop before you can see it.

 Please CC in any replies, thanks.

 -Dave

 On 3/11/13 8:58 AM, ndbeck...@gmail.com wrote:
 I want to update a plot in real time.  I did some goog search, and 
 saw various
 answers.  Trouble is, they aren't working.

 Here's a typical example:

 import matplotlib.pyplot as plt
 import numpy as np
 fig=plt.figure()
 plt.axis([0,1000,0,1])

 i=0
 x=list()
 y=list()

 while i 1000:
  temp_y=np.random.random()
  x.append(i)
  y.append(temp_y)
  plt.scatter(i,temp_y)
  i+=1
  plt.draw()

 If I run this, it draws nothing.

 This is my matplotlibrc:
 backend : Qt4Agg
 mathtext.fontset: stix



--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] real time plotting

2013-03-11 Thread David Hoese
Someone may have to correct me, but I think this has to do with the Qt4 
event loop and it not being run properly. When you get into real time 
plotting it can get kind of tricky. In your case (I got the same 
results). I have made real-time PyQt4 GUIs before and have always used 
separate QThreads and Qt signals/slots to update the plot. I've never 
used GTK so I'm not sure why that worked vs Qt, I would think they would 
use similar principles but matplotlib does some magic behind the scenes 
sometimes. You can see different results if you comment out the while 
loop and import the module into your python/ipython interpreter. After 
doing this you'll see the figure pop up (you don't even need the 
fig.canvas.show() for this part if interactive mode is on. I went one 
step further and turned the while loop into a function:


def one_iter(i):
# Contents of while loop

Calling this in the interpreter shows the figure updating after each 
call, but running in a loop (even with sleep) won't show any updates 
until the loop is done. In my opinion you have a few choices that really 
depend on your programming comfort level:


1. Don't make a real-time plot.
Do you really need a real-time plot that updates from some 
external source?
2. Maybe you should look at the matplotlib animation functionality 
(http://matplotlib.org/api/animation_api.html). I like this tutorial: 
http://jakevdp.github.com/blog/2012/08/18/matplotlib-animation-tutorial/. This 
won't get you a real-time GUI exactly, but it can help if what you're 
doing isn't too complicated. It can also be nice for making videos of 
plot animations.
3. If you need a GUI with multiple plots and you need for future feature 
creep, I would research making PyQt4 GUIs, QThreads, Qt signals and 
slots, and putting matplotlib figures into a PyQt4 GUI. This is complex 
if you are not familiar with GUI programming and will take a while.


Sorry I couldn't be of more help, but it really depends on what exactly 
you are doing.  Mainly, what do you mean by real-time? Do you really 
mean animation? Let me know what you come up with, I'm interested.


-Dave

P.S. Why use a while loop? You can do the same thing with:

for i in range(1000):
# Do stuff

On 3/11/13 10:34 AM, Neal Becker wrote:

I added fig.canvas.show(). It still does nothing.

If I add
mpl.use ('GTK'), now it seems to be doing realtime plotting.

import matplotlib as mpl

import matplotlib.pyplot as plt
plt.ion()
import numpy as np
fig=plt.figure()
plt.axis([0,1000,0,1])

i=0
x=list()
y=list()

fig.canvas.show()
while i 1000:
temp_y=np.random.random()
x.append(i)
y.append(temp_y)
plt.scatter(i,temp_y)
i+=1
plt.draw()



On Mon, Mar 11, 2013 at 10:35 AM, David Hoese dho...@gmail.com 
mailto:dho...@gmail.com wrote:


Oops forgot to change the subject line.

On 3/11/13 9:34 AM, David Hoese wrote:

You likely need to show() the canvas. I usually do this by
calling fig.canvas.show() before the for loop.
Since you are using a Qt4 backend the canvas used by the
figure is a QWidget, the basic component of a Qt4 GUI. I don't
know if there is a more matplotlib specific way of doing this,
but when dealing with a larger system this is how I do it.

I would also add a sleep (from time import sleep) of a
couple seconds for testing to make sure you are getting
through the entire for loop before you can see it.

Please CC in any replies, thanks.

-Dave


On 3/11/13 8:58 AM, ndbeck...@gmail.com
mailto:ndbeck...@gmail.com wrote:

I want to update a plot in real time.  I did some goog
search, and saw various
answers.  Trouble is, they aren't working.

Here's a typical example:

import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure()
plt.axis([0,1000,0,1])

i=0
x=list()
y=list()

while i 1000:
 temp_y=np.random.random()
 x.append(i)
 y.append(temp_y)
 plt.scatter(i,temp_y)
 i+=1
 plt.draw()

If I run this, it draws nothing.

This is my matplotlibrc:
backend : Qt4Agg
mathtext.fontset: stix






--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] real time plotting

2013-03-11 Thread David Hoese
I agree, I don't think that will work with mpl's animation stuff or at 
least I wouldn't want to do it that way. I've created GUIs that received 
data from a weather instrument in real-time. I did method 3 that I 
mentioned before because I knew the scientists using it were going to 
want more and more features.


...I FOUND A WAY FOR YOU TO CHEAT:
You can use the Qt processEvents() method to have it process 
drawing/painting operation between the event loop iterations. This 
method is frowned upon when doing real Qt GUIs, but eh go for it. If you 
aren't doing anything more serious than watching the output of your 
processing as it goes then try this:


import matplotlib

matplotlib.use('qt4agg')

import matplotlib as mpl

import matplotlib.pyplot as plt
plt.ion()
import numpy as np
from time import sleep
from PyQt4 import QtGui,QtCore
fig=plt.figure()
plt.axis([0,1000,0,1])

i=0
x=list()
y=list()

while i 1000:
temp_y=np.random.random()
x.append(i)
y.append(temp_y)
plt.scatter(i,temp_y)
i+=1
plt.draw()
sleep(1)
QtGui.qApp.processEvents()

Good luck,
Dave

On 3/11/13 12:59 PM, Neal Becker wrote:
I go through a compute loop that takes maybe a few seconds per pass, 
then plot a new point on the graph.  Do I have to?  No - I thought mpl 
was supposed to do this and wanted to learn how.  If it really doesn't 
work I'll do something else.


I don't think animation is correct here - I had the impression 
animation is where my update would be run as a callback, with a main 
loop that calls me periodically.  Could that fit the model I 
described, where a lengthy computation produces a new value every 
few/10s of seconds?



On Mon, Mar 11, 2013 at 1:55 PM, David Hoese dho...@gmail.com 
mailto:dho...@gmail.com wrote:


Someone may have to correct me, but I think this has to do with
the Qt4 event loop and it not being run properly. When you get
into real time plotting it can get kind of tricky. In your case (I
got the same results). I have made real-time PyQt4 GUIs before and
have always used separate QThreads and Qt signals/slots to update
the plot. I've never used GTK so I'm not sure why that worked vs
Qt, I would think they would use similar principles but matplotlib
does some magic behind the scenes sometimes. You can see different
results if you comment out the while loop and import the module
into your python/ipython interpreter. After doing this you'll see
the figure pop up (you don't even need the fig.canvas.show() for
this part if interactive mode is on. I went one step further and
turned the while loop into a function:

def one_iter(i):
# Contents of while loop

Calling this in the interpreter shows the figure updating after
each call, but running in a loop (even with sleep) won't show any
updates until the loop is done. In my opinion you have a few
choices that really depend on your programming comfort level:

1. Don't make a real-time plot.
Do you really need a real-time plot that updates from some
external source?
2. Maybe you should look at the matplotlib animation functionality
(http://matplotlib.org/api/animation_api.html). I like this
tutorial:
http://jakevdp.github.com/blog/2012/08/18/matplotlib-animation-tutorial/.
This won't get you a real-time GUI exactly, but it can help if
what you're doing isn't too complicated. It can also be nice for
making videos of plot animations.
3. If you need a GUI with multiple plots and you need for future
feature creep, I would research making PyQt4 GUIs, QThreads, Qt
signals and slots, and putting matplotlib figures into a PyQt4
GUI. This is complex if you are not familiar with GUI programming
and will take a while.

Sorry I couldn't be of more help, but it really depends on what
exactly you are doing.  Mainly, what do you mean by real-time? Do
you really mean animation? Let me know what you come up with, I'm
interested.

-Dave

P.S. Why use a while loop? You can do the same thing with:

for i in range(1000):
# Do stuff


On 3/11/13 10:34 AM, Neal Becker wrote:

I added fig.canvas.show(). It still does nothing.

If I add
mpl.use ('GTK'), now it seems to be doing realtime plotting.

import matplotlib as mpl

import matplotlib.pyplot as plt
plt.ion()
import numpy as np
fig=plt.figure()
plt.axis([0,1000,0,1])

i=0
x=list()
y=list()

fig.canvas.show()
while i 1000:
temp_y=np.random.random()
x.append(i)
y.append(temp_y)
plt.scatter(i,temp_y)
i+=1
plt.draw()



On Mon, Mar 11, 2013 at 10:35 AM, David Hoese dho...@gmail.com
mailto:dho...@gmail.com wrote:

Oops forgot to change the subject line.

On 3/11/13 9:34 AM, David Hoese wrote:

You likely need to show() the canvas. I usually do

[Matplotlib-users] importing basemap then shapely causes error

2013-02-08 Thread David Hoese
I've asked this question on GIS stack exchange site, but thought it 
would be good to post here too.  The SE question is here: 
http://gis.stackexchange.com/questions/50394/importing-matplotlib-basemap-and-shapely


I have a python script that uses matplotlib's basemap and another part 
that uses shapely to do an intersection of 2 polygons. If basemap is 
imported before shapely and I run the intersection I get this exception:


|   intersect_poly=  grid_poly.intersection(data_poly)
File  /sw/lib/python2.7/site-packages/shapely/geometry/base.py,  line334,  in 
 intersection
  return  geom_factory(self.impl['intersection'](self,  other))
File  /sw/lib/python2.7/site-packages/shapely/topology.py,  line53,  in  
__call__
  This operation produced a null geometry. Reason: unknown)
shapely.geos.TopologicalError:  This  operation produced a null geometry.  
Reason:  unknown|

If I import shapely first, everything works fine. I would assume this is 
because of some funkiness in the way they are accessing the GEOS 
library. I've checked that in both situations the same library file is 
loaded in shapely (print shapely.geos._lgeos).


Does anyone have an idea as to why this is happening and if there is a 
right way of doing this? Does this happen for anyone else? In the mean 
time I can just make sure to import shapely first (not sure if that 
affects basemap yet). Otherwise maybe I'll skim through the basemap source.


I'm using OSX(10.7) with a fink install that has libgeos3.3.3-shlibs, 
libgeos3.3.1-shlibs, libgeos3.3.1, libgeos3.3.0-shlibs, 
libgeos3.3.0, and shapely-py27 (1.2.16-1) installed. The current 
basemap version in fink is 1.0.2.


And here's a simple test script that reproduces the problem (flip the 
imports and it works):


|from  mpl_toolkitsimport  basemap
from  shapelyimport  geometry

g_ring=  [(-88.462425,  26.992203),  (-57.847187,  26.992203),  (-57.847187,  
17.599869),  (-88.462425,  17.599869),  (-88.462425,  26.992203)]
grid_g_ring=  [(-123.044,  59.8440001),  (-49.3849998,  
57.2890001),  (-65.0909994,  14.3350001),  (-113.133,  
16.369),  (-123.044,  59.8440001)]

data_poly=  geometry.Polygon(g_ring)
grid_poly=  geometry.Polygon(grid_g_ring)

print  grid_poly.intersection(data_poly).area|


Thanks again.  Please CC me in any replies.

-Dave
--
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Hiding labels in a legend?

2013-01-22 Thread David Erickson
Hello-
Prior to version 1.2 of MPL I was able to hide labels for certain
lines in the legend by setting the label=None when plotting a line,
however in 1.2 it is now showing the legend entry and visibly printing
None.  Is there a workaround to hide the label?

Thanks,
David

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding labels in a legend?

2013-01-22 Thread David Erickson
On Tue, Jan 22, 2013 at 1:20 PM, Benjamin Root ben.r...@ou.edu wrote:


 On Tue, Jan 22, 2013 at 1:57 PM, David Erickson halcyon1...@gmail.com
 wrote:

 Hello-
 Prior to version 1.2 of MPL I was able to hide labels for certain
 lines in the legend by setting the label=None when plotting a line,
 however in 1.2 it is now showing the legend entry and visibly printing
 None.  Is there a workaround to hide the label?

 Thanks,
 David


 I think you want _nolegend_ for those labels.  The hiding of the labels
 for None was an undocumented feature, I think, and has been fixed.

 http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.legend


Perfect, thanks Ben!

-David

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd:

2013-01-05 Thread David Craig
http://smallshop.lt/gbwpmas.php

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Colormap norm (vmin, vmax) based on visible part of figure

2012-12-16 Thread David Huard
Hi all,

I'm wondering if anyone knows how to compute colorbar limits (vmin, vmax)
based only on the visible portion of the figure. My use-case is a
pcolormesh(x, y, z) drawn over a Basemap instance. The coordinates x and y
cover the entire globe, but I'm only mapping the Arctic. What happens is
that the normalization is done over the entire z array, while only a subset
of z actually appears on the map.  The colors appearing on the map thus
cover only a small fraction of the entire color range.

From what I managed to understand, pcolormesh creates a collections of
patches colorcoded based on the array attribute. So my question is if there
is a builtin way to know which items of this collections are clipped so I
can mask this part of the array ?

Thanks a lot,

David
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] create an new axis with y-offset in the same subplot

2012-12-12 Thread David Yu
Greetings,

With the help of sankey-toolbox, we can plot sankey-diagrams automaticly:
The position of a sankey-object is automaticly calculated based on the
position of its prior-object and cannot be given manually; and when a
sankey-diagram is initialized, the position of the first sankey-object will
be assigned with the input of an axis. (the (0,0)-point will be the
center-point of this object)

And Here is the situation: i want to draw two sankey-diagrams in the same
subplot with a given y-offset, therefore are two coordinate systems with
y-offset required. I have tried the 'add_axes' method, but with this method
a new subplot is created and there will be a graphic scaling problem.

Now this is the question: Is it possible to create a new coordinate system
with a given y-offset, without creating new subplot?



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/create-an-new-axis-with-y-offset-in-the-same-subplot-tp40006.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] histogran2d and polar axis

2012-11-21 Thread David Craig

  
  

  

  
Hi,
  This one has been driving me crazy all day. I have three
  vectors, azimuth, frequency and power, which I would like
  to histogram and plot on a polar axis. I can plot a
  scatter plot this way no problem but the histogram gets
  messed up somehow. An example is below, anybody know how
  to do this properly??
  
  import random
  import numpy as np
  import matplotlib.pyplot as plt
  
  baz = np.zeros((20))
  freq = np.zeros((20))
  pwr = np.zeros((20))
  for x in range(20): 
   baz[x] = random.randint(20,25)*10
   freq[x] = random.randint(1,10)*10
   pwr[x] = random.randint(-10,-1)*10
  
  baz = baz*np.pi/180. 
  
  abins = np.linspace(0,2*np.pi,360) 
  sbins = np.linspace(1, 100) 
  
  H, xedges, yedges = np.histogram2d(baz, freq,
  bins=(abins,sbins), weights=pwr)
  
  plt.figure(figsize=(14,14))
  plt.subplot(111, polar=True)
  #plt.scatter(baz, freq, c=pwr)
  plt.pcolormesh(H)
  plt.show()
  


 
   

  

  

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Figure zoom crosshair color

2012-11-13 Thread David Brunell
Hello, I have what I hope is a simple question.  When producing a
figure/plot, I have a window which pops up with the figure inside and a few
tool buttons along the bottom, including Zoom to rectangle.  Clicking the
Zoom tool button, I'm presented with a black crosshair to select my zoom
rectangle.  Many of the images I work with are predominantly black; is
there any way to change the color of the crosshair so as to make it more
visible?  Thanks.
--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Qt4/PySide memory leak

2012-09-24 Thread David Honcik
I've run into a large memory leak using Matplotlib with PySide and the
Qt4 back end.  I'm using :
 
Python 3.2
Numpy 1.6.2
Pyside 1.1.1 (qt474)
Matplotlib 1.2 (first the Capetown Group port to Python 3, then 1.2 RC2)
 
on Windows XP 32 bit
 
 
I've tried using the Python 2.7 branch of all of the above and don't see
the problem.  I don't see the problem with the Tk back end.  I don't see
the problem with the Qt4 back end and PyQt4.  Only with the above
mentioned versions and using the Qt4 back end with PySide.
 
The following script will reproduce the problem :
 

import matplotlib
 
matplotlib.use('Qt4Agg')
matplotlib.rcParams['backend.qt4']='PySide'

import pylab
 
arrayX = []
arrayY = []
for nIndex in range(0, 100):
arrayX.append(nIndex)
arrayY.append(nIndex)
 
Figure = matplotlib.pyplot.figure(1)
Axes = Figure.add_axes([ 0.05, 0.05, 0.95, 0.95])
 
Axes.plot(arrayX,
  arrayY,
  color  = blue,
  marker = o,
  markersize = 5.0)
 
Axes.set_xlim(arrayX[0], arrayX[len(arrayX) - 1])
Axes.set_ylim(arrayY[0], arrayY[len(arrayY) - 1])
 
matplotlib.pyplot.show()


 
I run the above, grab the lower right sizing handle on the plot window
and start resizing the window.  Watching the python process in task
manager, each resize leaks a noticeable amount of memory.  A few minutes
of this will get process memory up to ~2.5 GB.  At that point it
crashes.
 
I'm new here, am I in the right place?
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: NavigationToolbar2WxAgg Buttons Disappear

2012-08-16 Thread David Grudoski

 (Corrects the top posting of the earlier replies, Sorry)
 
 On Aug 15, 2012, at 5:17 AM, Benjamin Root wrote:
 
 
 
 On Wednesday, August 15, 2012, David Grudoski wrote:
 Hi All,
 I've encountered this problem with the both NavigationToolbar2Wx and the 
 NavigationToolbar2WxAgg.
 When I click the Zoom or Pan button the button disappears. The 
 functionality is maintained so if a click the location that the button used 
 to be displayed at the toggle action still works its just that the button 
 is no longer displayed.
 Can any one help me fix this?
 Thanks
 David
 
 Which version of matplotlib are you using?
 
 Ben Root
 
 
 
 
 From: David Grudoski da...@wemeasureit.com
 Date: August 15, 2012 6:30:20 AM PDT
 To: Benjamin Root ben.r...@ou.edu
 Cc: matplotlib-users@lists.sourceforge.net 
 matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] NavigationToolbar2WxAgg Buttons Disappear
 
 I'm running:
 Matplotlib 1.1.0
 wxPython 2.9.2.4 osx-carbon (classic)
 Python 2.6
 on Mac OSX 10.6.8
 
 I tried running  the  wxcursor_demo.py from the Matplotlib examples it also 
 behave the same way. 
 When the zoom or pan icon is selected it disappears from the toolbar but the 
 space it occupies behaves as if it is still there just not visible.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] NavigationToolbar2WxAgg Buttons Disappear

2012-08-15 Thread David Grudoski
Hi All,
I've encountered this problem with the both NavigationToolbar2Wx and the 
NavigationToolbar2WxAgg.
When I click the Zoom or Pan button the button disappears. The functionality is 
maintained so if a click the location that the button used to be displayed at 
the toggle action still works its just that the button is no longer displayed.
Can any one help me fix this?
Thanks 
David

Here's the code that demonstrated the problem
##
#Start of Code#
##

#!/usr/bin/env python
# encoding: UTF-8

Basic wxPython App w DrawPanel.py



import sys
reload(sys) 
sys.setdefaultencoding(utf-8)
import os
import time
import numpy as np

import matplotlib
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
from matplotlib.figure import Figure
import pylab as plt
import wx

from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg

class DrawPanel(wx.Panel):
 This class constructs a Matplotlib figure and canvas to allow for 
plots. 
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
#Create the widgets
self.figure = Figure(figsize=(1,1))
self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
self.toolbar = NavigationToolbar2WxAgg(self.canvas) 
sizer = wx.BoxSizer(wx.VERTICAL)
# add to sizer allows resizing
sizer.Add(self.toolbar, 0, wx.LEFT|wx.TOP)
sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW)
self.SetSizer(sizer)
self.Fit()
# plot some data
self.x=np.arange(0,10,.1)
self.y=plt.sin(self.x)
self.init_plot()

def init_plot(self):
self.figure.clf()
self.ax = self.figure.gca()
self.ax.plot(self.x, self.y)
self.canvas.draw()


class MainFrame(wx.Frame):
This is the Main Frame
#--
def __init__(self):
Constructor
wx.Frame.__init__(self, None, title=Basic wxPython App w 
DrawPanel,size=(800,600))
# Create StatusBar
self.sb=self.CreateStatusBar()
self.SetStatusText('Basic wxPython App w DrawPanel')
#--
self.Freeze() # need this to prevent flicker during plot 
resize/redraw
self.mainpanel = DrawPanel(self)
self.Layout()
self.Thaw()
self.Show()

#--
if __name__ == __main__:
app = wx.App(False)
frame = MainFrame()
app.MainLoop()

##
#End of Code   #
##


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] NavigationToolbar2WxAgg Buttons Disappear

2012-08-15 Thread David Grudoski
I'm running:
Matplotlib 1.1.0
wxPython 2.9.2.4 osx-carbon (classic)
Python 2.6
on Mac OSX 10.6.8

On Aug 15, 2012, at 5:17 AM, Benjamin Root wrote:

 
 
 On Wednesday, August 15, 2012, David Grudoski wrote:
 Hi All,
 I've encountered this problem with the both NavigationToolbar2Wx and the 
 NavigationToolbar2WxAgg.
 When I click the Zoom or Pan button the button disappears. The functionality 
 is maintained so if a click the location that the button used to be displayed 
 at the toggle action still works its just that the button is no longer 
 displayed.
 Can any one help me fix this?
 Thanks
 David
 
 Which version of matplotlib are you using?
 
 Ben Root

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Font in figures

2012-07-12 Thread David Kremer
Hello, I want to ask some questions about fonts in figures.

I think that the best figures are achieved when the font used is the 
same as in the surrounding text in all the figure. This is the case when 
I use the latex notation (between $$), but unfortunately the police used 
for the axis is not the same (this is sans-serif font).

On the other hand, you could have a sans-serif font in your document, 
and thus you would like your equations to be also sans-serif as far it 
is possible.

The reason I write to this mailing is because I want to know if it 
exists general recipes to have the same font in all the figure with 
matplotlib.

The first thing I thought about as a general recipie is to use an 
'epslatex' output, which is then compiled with latex to give an eps or a 
pdf file, but I am not sure if it is possible to achieve such a result.

If you have some idea about that, let me know.

Thanks,

David

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Increasing font size in axis ticks

2012-07-05 Thread David Kremer
Hello,

I know how one can increase the font size in the xlabel and ylabel 
fields. I use the methode presented in:

http://matplotlib.sourceforge.net/examples/pylab_examples/dannys_example.html

But I don't know how to increase the font size for the numbers labelling 
the xticks or the yticks, and found nothing in the doc. May you help ?

David

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ginput with undefined number of points

2012-06-07 Thread David Craig

Hi,
I trying to define an area in a pcolor plot (several plots) using the 
ginput(). However since it is an irregular shape and will be different 
in each plot so I cant define how many points there will be before hand, 
I've tried the following but it requires a double click at each point, 
which I would like to avoid as it duplicates points


|x = randn(10,10)
imshow(x)

button = False
points = []
while button == False:
points.append(ginput(1))
button = waitforbuttonpress()
|

Anyone know a better way to go about this??
thanks
Dave

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dark or inverted color scheme

2012-06-05 Thread David Smith
I got pretty good results with the code below.  Note that I am reading the
FLIP_COLORS from a gui checkbox.

   FLIP_COLORS = self.dark_background_flag.get()
if FLIP_COLORS:
matplotlib.rcParams['figure.facecolor'] = '0.0'
matplotlib.rcParams['axes.edgecolor'] = 'grey'
matplotlib.rcParams['text.color'] = 'white'
matplotlib.rcParams['ytick.color'] = '#00ff00'
matplotlib.rcParams['xtick.color'] = '#0ED5D5'
matplotlib.rcParams['axes.labelcolor'] = '#0ED5D5'
matplotlib.rcParams['axes.facecolor'] = 'black'
matplotlib.rcParams['grid.color'] = '0.3'
matplotlib.rcParams['grid.linestyle'] = '-'
matplotlib.rcParams['lines.markeredgewidth'] = 0.0
else:
matplotlib.rcdefaults()

## I seems like setting matplotlib.rcParams['figure.facecolor']
isn't
## enough.  I think this is a bug and set_facecolor() is a
work-around.
fig.set_facecolor(matplotlib.rcParams['figure.facecolor'])

This will flip and also flip back.  I found a few colors didn't follow
the crowd.  For example, axes.ylabel.color doesn't seem to have
an entry in rcParams.  For this, I have to modify the plot generation
statments something like:

   ax.set_ylabel('Voltage (volts)',
color=matplotlib.rcParams['ytick.color'])

That sets the ylabel text to be the same as the tick marks.  I also have to
do things like that to change line colors and such when
going flipping colors.

DavidS
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] TypeError: coercing to Unicode: need string or buffer, dict found

2012-05-23 Thread Waléria Antunes David
Hi,

Anyone know how to solve this error?

Exception Type: TypeError Exception Value: coercing to Unicode: need string
or buffer, dict found

Can you help me??

See mycode: http://dpaste.com/751460/

And see my Traceback: http://dpaste.com/750773/


Thanks,
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib-users Digest, Vol 72, Issue 25

2012-05-23 Thread Waléria Antunes David
Hi Mike,

About this question: TypeError: coercing to Unicode: need string or buffer,
dict found

The version of matplotlib that i'm using is matplotlib-0.99.1-py2.6

And how do I remove the font cache in ~ / .matplotlib / fontList.cache

My Operating System is Windows.

Thanks,

On Wed, May 23, 2012 at 11:15 AM, 
matplotlib-users-requ...@lists.sourceforge.net wrote:

 Send Matplotlib-users mailing list submissions to
matplotlib-users@lists.sourceforge.net

 To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 or, via email, send a message with subject or body 'help' to
matplotlib-users-requ...@lists.sourceforge.net

 You can reach the person managing the list at
matplotlib-users-ow...@lists.sourceforge.net

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Matplotlib-users digest...


 Today's Topics:

   1. Re: Difference in show and output file (rajtendulkar)
   2. TypeError: coercing to Unicode: need string orbuffer, dict
  found (Wal?ria Antunes David)
   3. Re: TypeError: coercing to Unicode: need string or buffer,
  dict found (Michael Droettboom)
   4. Re: barchart errorbars always in both directions (Benjamin Root)
   5. Re: Slow imshow when zooming or panning with several synced
  subplots (Sergi Pons Freixes)
   6. Re: barchart errorbars always in both directions
  (Meesters, Aesku.Kipp Institute)


 --

 Message: 1
 Date: Wed, 23 May 2012 02:49:05 -0700 (PDT)
 From: rajtendulkar pranav.tendul...@gmail.com
 Subject: Re: [Matplotlib-users] Difference in show and output file
 To: matplotlib-users@lists.sourceforge.net
 Message-ID: 33894599.p...@talk.nabble.com
 Content-Type: text/plain; charset=us-ascii


 Just in case, if anyone needs the answer, I figured it out.
 I used the transData transform in order to draw the lines correctly.

 Here is the code -

 # The code below is to add the lines near the tick labels
 fig = barGraph.fig
 xAxisLim=barGraph.ax.xaxis.get_view_interval()
 tickLocArray = barGraph.ax.xaxis.get_majorticklocs()
 yStart=-70
 yEnd=-0.5
 line = Line2D([xAxisLim[0], xAxisLim[0]],
  [yStart,yEnd],linewidth=2, color='black',
   transform=barGraph.ax.transData)

 fig.lines.append(line)

 for i in xrange(11):
lnWidth=2
yStartOffset=0
if((i+1)%4 != 0):
lnWidth=1
yStartOffset=20
xOffset = tickLocArray[i] + (tickLocArray[i+1] - tickLocArray[i])/2
line = Line2D([xOffset, xOffset],
  [yStart+yStartOffset,yEnd],linewidth=lnWidth, color='black',
   transform=barGraph.ax.transData)
fig.lines.append(line)


 line = Line2D([xAxisLim[1], xAxisLim[1]],
  [yStart,yEnd],linewidth=2, color='black',
   transform=barGraph.ax.transData)

 fig.lines.append(line)

 plt.figtext(0.247, 0.05, '1')
 plt.figtext(0.523, 0.05, '2')
 plt.figtext(0.797, 0.05, '4')


 Thank You!
 Raj


 rajtendulkar wrote:
 
  Dear All,
 
  I am trying to write a program in matplotlib to generate stacked bar
  graphs.
  My problem is that the commands -  plt.show() and
  self.fig.savefig(fileName) generate different outputs.
  I tried different output formats like PDF, PNG, EPS. But the problem
  remains the same.
  This happens for the lines that I am trying to draw outside the plot.
  I am trying to draw vertical lines between xticklabels.
  I have uploaded the data file and the code file.
   http://old.nabble.com/file/p33893817/data.dat data.dat
   http://old.nabble.com/file/p33893817/matplot1.py matplot1.py
  Could anyone explain how to resolve this problem?
 
  Thank You,
  Raj
 

 --
 View this message in context:
 http://old.nabble.com/Difference-in-show-and-output-file-tp33893817p33894599.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.




 --

 Message: 2
 Date: Wed, 23 May 2012 09:16:09 -0300
 From: Wal?ria Antunes David waleriantu...@gmail.com
 Subject: [Matplotlib-users] TypeError: coercing to Unicode: need
string or   buffer, dict found
 To: Matplotlib Users matplotlib-users@lists.sourceforge.net
 Message-ID:
CAEwvc_uK2icxVBzF5Aykka-_Mig4EoCNovgt2jPJHT=xqdv...@mail.gmail.com
 
 Content-Type: text/plain; charset=iso-8859-1

 Hi,

 Anyone know how to solve this error?

 Exception Type: TypeError Exception Value: coercing to Unicode: need string
 or buffer, dict found

 Can you help me??

 See mycode: http://dpaste.com/751460/

 And see my Traceback: http://dpaste.com/750773/


 Thanks,
 -- next part --
 An HTML attachment was scrubbed...

 --

 Message: 3
 Date: Wed, 23 May 2012 08:29:48 -0400
 From: Michael Droettboom md...@stsci.edu
 Subject: Re: [Matplotlib-users] TypeError: coercing to Unicode: need
string or buffer, dict found
 To: matplotlib

[Matplotlib-users] basemap and fill_between()

2012-05-13 Thread David Craig
Hi, I'm having a problem usinf fill_between() with basemap. I plot two
great circles and want to shade the region between them. My code is below,
it doesnt give any error just creates the plot without filling the area.
Does anyone know if it's possible to do this or should I try a different
method?
Thanks,
David

from mpl_toolkits.basemap import Basemap
from pylab import *

### PARAMETERS FOR MATPLOTLIB :
import matplotlib as mpl
rcParams['font.size'] = 10.
rcParams['font.family'] = 'Comic Sans MS'
rcParams['axes.labelsize'] = 8.
rcParams['xtick.labelsize'] = 6.
rcParams['ytick.labelsize'] = 6.

def shoot(lon, lat, azimuth, maxdist=None):
Shooter Function
Original javascript on http://williams.best.vwh.net/gccalc.htm
Translated to python by Thomas Lecocq

glat1 = lat * pi / 180.
glon1 = lon * pi / 180.
s = maxdist / 1.852
faz = azimuth * pi / 180.

EPS= 0.005
if ((abs(cos(glat1))EPS) and not (abs(sin(faz))EPS)):
alert(Only N-S courses are meaningful, starting at a pole!)

a=6378.13/1.852
f=1/298.257223563
r = 1 - f
tu = r * tan(glat1)
sf = sin(faz)
cf = cos(faz)
if (cf==0):
b=0.
else:
b=2. * arctan2 (tu, cf)

cu = 1. / sqrt(1 + tu * tu)
su = tu * cu
sa = cu * sf
c2a = 1 - sa * sa
x = 1. + sqrt(1. + c2a * (1. / (r * r) - 1.))
x = (x - 2.) / x
c = 1. - x
c = (x * x / 4. + 1.) / c
d = (0.375 * x * x - 1.) * x
tu = s / (r * a * c)
y = tu
c = y + 1
while (abs (y - c)  EPS):

sy = sin(y)
cy = cos(y)
cz = cos(b + y)
e = 2. * cz * cz - 1.
c = y
x = e * cy
y = e + e - 1.
y = (((sy * sy * 4. - 3.) * y * cz * d / 6. + x) *
  d / 4. - cz) * sy * d + tu

b = cu * cy * cf - su * sy
c = r * sqrt(sa * sa + b * b)
d = su * cy + cu * sy * cf
glat2 = (arctan2(d, c) + pi) % (2*pi) - pi
c = cu * cy - su * sy * cf
x = arctan2(sy * sf, c)
c = ((-3. * c2a + 4.) * f + 4.) * c2a * f / 16.
d = ((e * cy * c + cz) * sy * c + y) * sa
glon2 = ((glon1 + x - (1. - c) * d * f + pi) % (2*pi)) - pi

baz = (arctan2(sa, b) + pi) % (2 * pi)

glon2 *= 180./pi
glat2 *= 180./pi
baz *= 180./pi

return (glon2, glat2, baz)

#Create a basemap around N. Atlantic
m = Basemap(llcrnrlon=-45.0,llcrnrlat=30.0,urcrnrlon=15.0,urcrnrlat=75.0,
resolution='i',projection='merc',lon_0=-17.5,lat_0=60.0)


m.drawcountries(linewidth=0.5)
m.drawcoastlines(linewidth=0.5)
m.bluemarble()
m.drawparallels(arange(40.,75.,10.),labels=[1,0,0,0],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2)
# draw parallels
m.drawmeridians(arange(-45.,15.,10.),labels=[0,0,0,1],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2)
# draw meridians

# Shade region defined by great circles.
x1, y1 = -9.1676613, 51.602
az1 = 270.
az2 = 290.
maxdist = 2000
x2, y2, baz = shoot(x1, y1, az1, maxdist)
x3, y3, baz = shoot(x1, y1, az2, maxdist)

m.drawgreatcircle(x1, y1, x2, y2, del_s=10, color='gray', lw=1.)
m.drawgreatcircle(x1, y1, x3, y3, del_s=10, color='gray', lw=1.)
a=linspace(x3,x1)
b=linspace(y2,y1)
c=linspace(y3,y1)
fill_between(a, b, c, where=None, alpha=0.2)
show()
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] symlog linear to log transition plot position?

2012-05-04 Thread David Erickson

On 5/3/2012 7:01 AM, Michael Droettboom wrote:

On 05/03/2012 09:48 AM, Benjamin Root wrote:



On Wed, May 2, 2012 at 3:59 PM, David Erickson deric...@stanford.edu 
mailto:deric...@stanford.edu wrote:


On 5/1/2012 5:41 AM, Benjamin Root wrote:



On Tue, May 1, 2012 at 6:42 AM, David Erickson
deric...@stanford.edu mailto:deric...@stanford.edu wrote:

Hi I need to use the symlog yscale in my graph, I have a lot
of data
that needs to be displayed linearly, with a small fraction
at the upper
end of the range that needs to be displayed in log scale due
to its
distance from the main data.  The symlog scale works great,
however I'd
like to adjust the actual vertical graph position where it
crosses from
linear to log (not the threshold), because right now only
~25% of the y
space is being given to linear, and I'd like it to be more
like 80%.  Is
this possible?

Thanks!
David


Isn't linthreshy what you are looking for?  It denotes the range
where the scale is linear.  So, if it is 25, then from -25 to 25
the scale will be linear.  After 25, it will be log.

Maybe I am missing something in your description?

Cheers!
Ben Root



Hi Ben,
No unfortunately linthreshy only controls the crossover point
from linear to log scale, it does not give you control over where
this occurs on the figure's y coordinates.  I've attached a
picture to explain, currently the linear part of the graph is
only being given around 25% of the vertical space, I'd like to
reverse that and give linear ~75% and log at the top only the
remaining 25%.  Is this possible?  I've been digging around in
the SymmetricalLogScale and SymmetricalLogLocator classes and
can't even tell how this range is allocated.

Thanks in advance!!
-David


David,

Thanks, that is much clearer what you are looking for.  You are 
right, I can't seem to find any sort of obvious way to get what you 
want.  Reading the docs for the SymLog scale indicates to me that the 
author intended for the logrithmic portion to be most interesting and 
the linear portion was only supposed to be a work-around the whole 
log(0) issue.  Could you file an issue on the github page so that we 
can mark it as a feature request?


Just getting to this after some unexpected absences.  Yes -- that is 
how symlog was originally intended, so there isn't currently any way 
to configure it.  Please file the issue and assign it to me.  I'll 
have a look at what needs to be added to support this.


Mike


Perfect, thanks Mike!

-David
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] symlog linear to log transition plot position?

2012-05-02 Thread David Erickson

On 5/1/2012 5:41 AM, Benjamin Root wrote:



On Tue, May 1, 2012 at 6:42 AM, David Erickson deric...@stanford.edu 
mailto:deric...@stanford.edu wrote:


Hi I need to use the symlog yscale in my graph, I have a lot of data
that needs to be displayed linearly, with a small fraction at the
upper
end of the range that needs to be displayed in log scale due to its
distance from the main data.  The symlog scale works great,
however I'd
like to adjust the actual vertical graph position where it crosses
from
linear to log (not the threshold), because right now only ~25% of
the y
space is being given to linear, and I'd like it to be more like
80%.  Is
this possible?

Thanks!
David


Isn't linthreshy what you are looking for?  It denotes the range where 
the scale is linear.  So, if it is 25, then from -25 to 25 the scale 
will be linear.  After 25, it will be log.


Maybe I am missing something in your description?

Cheers!
Ben Root



Hi Ben,
No unfortunately linthreshy only controls the crossover point from 
linear to log scale, it does not give you control over where this occurs 
on the figure's y coordinates.  I've attached a picture to explain, 
currently the linear part of the graph is only being given around 25% of 
the vertical space, I'd like to reverse that and give linear ~75% and 
log at the top only the remaining 25%.  Is this possible?  I've been 
digging around in the SymmetricalLogScale and SymmetricalLogLocator 
classes and can't even tell how this range is allocated.


Thanks in advance!!
-David
attachment: symlog.png--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] symlog linear to log transition plot position?

2012-05-01 Thread David Erickson
Hi I need to use the symlog yscale in my graph, I have a lot of data 
that needs to be displayed linearly, with a small fraction at the upper 
end of the range that needs to be displayed in log scale due to its 
distance from the main data.  The symlog scale works great, however I'd 
like to adjust the actual vertical graph position where it crosses from 
linear to log (not the threshold), because right now only ~25% of the y 
space is being given to linear, and I'd like it to be more like 80%.  Is 
this possible?

Thanks!
David

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] installing basemap

2012-04-03 Thread David Craig
Hi again,
So I removed everything and started again ( with version 1-0-2 :) )
but am still having trouble, GEOS_DIR seems to be set correctly but I
get the following error when trying to make the GEOS library with,

sudo make; make install

make[3]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
test -z /home/davcra/lib || /bin/mkdir -p /home/davcra/lib
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libgeos.la
'/home/davcra/lib'
libtool: install: /usr/bin/install -c .libs/libgeos-3.3.1.so
/home/davcra/lib/libgeos-3.3.1.so
libtool: install: (cd /home/davcra/lib  { ln -s -f libgeos-3.3.1.so
libgeos.so || { rm -f libgeos.so  ln -s libgeos-3.3.1.so libgeos.so;
}; })
libtool: install: /usr/bin/install -c .libs/libgeos.lai
/home/davcra/lib/libgeos.la
libtool: install: /usr/bin/install -c .libs/libgeos.a /home/davcra/lib/libgeos.a
libtool: install: chmod 644 /home/davcra/lib/libgeos.a
libtool: install: ranlib /home/davcra/lib/libgeos.a
libtool: finish:
PATH=/usr/ncl_files/bin:/usr/ncl_files/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/davcra/.local/bin:/home/davcra/bin:/sbin
ldconfig -n /home/davcra/lib
--
Libraries have been installed in:
   /home/davcra/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
 during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
 during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
--
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
Making install in capi
make[1]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make[2]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
test -z /home/davcra/lib || /bin/mkdir -p /home/davcra/lib
 /bin/sh ../libtool   --mode=install /usr/bin/install -c
libgeos_c.la '/home/davcra/lib'
libtool: install: warning: relinking `libgeos_c.la'
libtool: install: (cd /home/davcra/basemap-1.0.2/geos-3.3.1/capi;
/bin/sh /home/davcra/basemap-1.0.2/geos-3.3.1/libtool  --tag CXX
--mode=relink g++ -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long
-ffloat-store -g -O2 -version-info 8:1:7 -no-undefined -o libgeos_c.la
-rpath /home/davcra/lib libgeos_c_la-geos_c.lo
libgeos_c_la-geos_ts_c.lo ../src/libgeos.la )
mv: cannot move `libgeos_c.so.1.7.1' to `libgeos_c.so.1.7.1U': Permission denied
libtool: install: error: relink `libgeos_c.la' with the above command
before installing it
make[2]: *** [install-libLTLIBRARIES] Error 1
make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make: *** [install-recursive] Error 1

any ideas??
thanks
D

On 3/31/12 5:48 AM, David Craig wrote:
 Hi, I previously installed basemap by using the yum command. This
 installed version 0.99.4. I want to install the latest version so I
 can use shaded relief etc. This may be more of a linux problem but as
 I am more familiar with python than linux I thought someone here may
 be able to help.
 Following the website instructions
 (http://matplotlib.github.com/basemap/users/installing.html) I
 downloaded the latest version and untarred it. Then in the basemap
 directory (which contains geos-3.2.0) I try to set the environment
 variable GEOS_DIR to point to the location of libgeos_c and geos_c.h.
 I use the find command to locate the files,
 /find / -name geos_c.h/ returns the location of that file as
 //usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h/
 and
 /find / -name libgeos*/
 returns
 //libgeos_c_la-geos_c.Plo
 /usr/lib/libgeos-3.3.1.so http://libgeos-3.3.1.so
 /usr/lib/libgeos_c.so.1.7.1
 /usr/lib/libgeos_c.so.1/
 so I set GEOS_DIR to /usr/lib(not sure if this is correct).
 I then cd to the basemap directory and run,
 python setup.py install
 [davcra@... basemap-1.0.1]$ sudo python setup.py install
 [sudo] password for davcra:
 checking for GEOS lib in /root 
 checking for GEOS lib in /usr 
 checking for GEOS lib in /usr/local 
 checking for GEOS lib in /sw 
 checking for GEOS lib in /opt 
 checking for GEOS lib in /opt/local 

 Can't find geos library . Please set the
 environment variable GEOS_DIR to point to the location

[Matplotlib-users] trouble with pcolor

2012-04-01 Thread David Craig
Hi, I am trying to use pcolor to visualise three variables. For example if
I have a value for z at x and a value for z at y something like [x1, x2,
x3] = [z1, z2, z3] and [y1, y2, y3] = [z2, z1, z3]. Then I use meshgrid to
create the grid for x and y,
X, Y = meshgrid(x, y)
the result is two array's of shape (3,3).
I then need to reshape Z to use pcolor, which is what I am having trouble
with. I know I want a result like,

y3  0   0  z3

y2  z1 0   0

y1  0  z2  0

 x1 x2 x3

but have no idea how to create it. Anyone able to help??
thanks
D
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] installing basemap

2012-03-31 Thread David Craig
Hi, I previously installed basemap by using the yum command. This installed
version 0.99.4. I want to install the latest version so I can use shaded
relief etc. This may be more of a linux problem but as I am more familiar
with python than linux I thought someone here may be able to help.
Following the website instructions (
http://matplotlib.github.com/basemap/users/installing.html) I downloaded
the latest version and untarred it. Then in the basemap directory (which
contains geos-3.2.0) I try to set the environment variable GEOS_DIR to
point to the location of libgeos_c and geos_c.h.
I use the find command to locate the files,
*find / -name geos_c.h* returns the location of that file as *
/usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h*
and
*find / -name libgeos**
returns
*/libgeos_c_la-geos_c.Plo
/usr/lib/libgeos-3.3.1.so
/usr/lib/libgeos_c.so.1.7.1
/usr/lib/libgeos_c.so.1*
so I set GEOS_DIR to /usr/lib(not sure if this is correct).
I then cd to the basemap directory and run,
python setup.py install

[davcra@David basemap-1.0.1]$ sudo python setup.py install
[sudo] password for davcra:
checking for GEOS lib in /root 
checking for GEOS lib in /usr 
checking for GEOS lib in /usr/local 
checking for GEOS lib in /sw 
checking for GEOS lib in /opt 
checking for GEOS lib in /opt/local 

Can't find geos library . Please set the
environment variable GEOS_DIR to point to the location
where geos is installed (for example, if geos_c.h
is in /usr/local/include, and libgeos_c is in /usr/local/lib,
set GEOS_DIR to /usr/local), or edit the setup.py script
manually and set the variable GEOS_dir (right after the line
that says set GEOS_dir manually here.

The problem seems to be with GEOS_DIR but I am not sure what I should set
it to.
Thanks
D
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Clearing figures from memory

2012-03-24 Thread David Verelst
A while ago I had exactly the same problem. I was running a script that 
create a lot of figures and saved them (as .png and .eps files) for 
viewing later (so not using the interactive viewing feature from 
pyplot). If I remember well, there was also a problem with the close() 
statement leaving some stuff in memory. Unfortunately I don't remember 
how the details went and how it got fixed. I guess I should have used 
the mailing list or created a bug report.

Anyway, when I need to generate a massive amount of figures these days I 
bypass the pyplot interface completely and go straight for the 
matplotlib API (at least as far as I understand this approach myself). 
When using pyplot, some figure tweaks did not persist upon saving, but 
that might as well have been due to my limited matplotlib knowledge. The 
procedure was inspired by this blog post: 
http://sjohannes.wordpress.com/2010/06/11/using-matplotlib-in-a-web-application/
 
and goes as follows:

from matplotlib.figure import Figure
# dependent on the backend you use
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as 
FigCanvas
# set figure size, dpi and initiate a workable fig object
fig = Figure(figsize=(figsize_x, figsize_y), dpi=dpi)
canvas = FigCanvas(fig)
fig.set_canvas(canvas)
# tweak white spacings
fig.subplots_adjust(left=wsleft, bottom=wsbottom, right=wsright,
top=wstop, wspace=wspace, hspace=hspace)
# big main title
fig.suptitle(grandtitle, size='x-large')
# create a subplot
ax = fig.add_subplot(nr_rows, nr_cols, plot_nr)

# do all your plotting stuff here on ax

# save the figure and close
fig.savefig('/path/to/figure/figname.png')
canvas.close()
fig.clear()

If interested, I can give you a more elaborate and working example of 
which parameters I tune how exactly.

Regards,
David




On 23/03/12 19:45, Eric Firing wrote:
 On 03/23/2012 08:05 AM, Albert Kottke wrote:
 I am having problems clearing figures from memory. After saving the
 figure, I use pyplot.close() on the figure handle and then del all of
 the data and figure, as shown here:

 fig.savefig('plots/%(record_id)05i' % recording)
 plt.close(fig)

 del accel, fourier_amp, fig, time, disp
 gc.collect()

 Despite this, the figures don't appear to be closing. I am trying to
 make 30k plots and I have to kill script every couple thousand and
 restart because I run out of memory.

 Any suggestions?
 You are running a standalone script, correct?  Make sure you are using
 only the agg backend.  Before the first import of pyplot, do

 import matplotlib
 matplotlib.use(agg)

 I don't know if that will help, but it can't hurt.

 You might find matplotlib.cbook.report_memory() to be useful in tracking
 down the problem.

 Eric


 Albert

 --
 This SF email is sponsosred by:
 Try Windows Azure free for 90 days Click Here
 http://p.sf.net/sfu/sfd2d-msazure
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

 --
 This SF email is sponsosred by:
 Try Windows Azure free for 90 days Click Here
 http://p.sf.net/sfu/sfd2d-msazure
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Problem using plot_surface.

2012-03-23 Thread David Craig
Hi, I have three variables I would like to plot using plot_surface but I 
keep getting the error given at the bottom. Anyone know what I am doing 
wrong?? My code is as follows,

fig3 = plt.figure()
ax = Axes3D(fig3)
X = np.zeros((78,1))
Y = np.zeros((78,1))
Z = np.zeros((78,1))
for p in range(len(data)):
 X[p,0] = data[p][1] #distance
 Y[p,0] = data[p][3] #azimuth
 Z[p,0] = data[p][4] #snr
X, Y = np.meshgrid(X, Y)
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)


ValueErrorTraceback (most recent call last)

/home/davcra/python_scripts/plot_snr_az.py in module()
  48 Z[p,0] = data[p][4] #snr
  49 X, Y = np.meshgrid(X, Y)
--- 50 surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
  51 #fig.colorbar(surf, shrink=0.5, aspect=5)

  52 #plt.show()


/usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in 
plot_surface(self, X, Y, Z, *args, **kwargs)
 616 normals.append(np.cross(v1, v2))
 617
-- 618 polyc = art3d.Poly3DCollection(polys, *args, **kwargs)
 619 if cmap is not None:
 620 polyc.set_array(np.array(avgz))

/usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/art3d.pyc in 
__init__(self, verts, *args, **kwargs)
 282 '''
 283
-- 284 PolyCollection.__init__(self, verts, *args, **kwargs)
 285 self._zsort = 1
 286 self._sort_zpos = None

/usr/lib64/python2.6/site-packages/matplotlib/collections.pyc in 
__init__(self, verts, sizes, closed, **kwargs)
 666 Collection.__init__(self,**kwargs)
 667 self._sizes = sizes
-- 668 self.set_verts(verts, closed)
 669 __init__.__doc__ = cbook.dedent(__init__.__doc__) % 
artist.kwdocd
 670

/usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/art3d.pyc in 
set_verts(self, verts, closed)
 304 def set_verts(self, verts, closed=True):
 305 '''Set 3D vertices.'''
-- 306 self.get_vector(verts)
 307 # 2D verts will be updated at draw time

 308 PolyCollection.set_verts(self, [], closed)

/usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/art3d.pyc in 
get_vector(self, segments3d)
 297 segis.append((si, ei))
 298 si = ei
-- 299 xs, ys, zs = zip(*points)
 300 ones = np.ones(len(xs))
 301 self._vec = np.array([xs, ys, zs, ones])

ValueError: need more than 0 values to unpack
WARNING: Failure executing file: plot_snr_az.py

thanks,
David

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] move legend to the foreground: how to use set_zorder() correctly?

2012-03-22 Thread David Verelst
Hi All,

I am plotting on two different y-axes: one on the left (ax1) and one on 
the right (ax2). Both share the same x-axes. The problem I am facing 
relates back to the zorder of the legend (at least, that is what I 
think): I want it to be on the foreground at all times. In order to do 
so, I change the zorder of the ax1.legend (left y axes) such that the 
ax2.plots (right y-axes) are under ax1.legend. However, that doesn't 
work: all the plots on the right axes (so using ax2) end up above the 
legend 1 on the left, despite having a lower zorder.

Note that I am also giving the grids on both ax1 and ax2 a lower zorder 
value compared to the legends, but the grid still ends up on top of 
legend 1 on the left.

# version info:

# Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2

# NumPy 1.6.1, Matplotlib 1.1.0

import pylab as plt

import numpy as np

# plotting on the left y-axes,

ax1 = plt.axes(zorder=10)

ax1.plot(range(0,5,1), 'r', label='ax1 ax1 ax1 ax1', zorder=11)

ax1.plot(np.arange(3,4.1,1), 'r--', label='ax1 ax1 ax1 ax1', zorder=12)

gr1 = ax1.grid(zorder=13)

# legend of the left y-axes, force high zorder

leg1 = ax1.legend(loc='upper left')

leg1.set_zorder(30)

# plotting on the right y-axes,

ax2 = plt.twinx()

ax2.set_zorder(20)

ax2.plot(range(4,-1,-1), 'b', label='ax2 ax2 ax2 ax2', zorder=21)

ax2.plot(np.arange(4,2.9,-1), np.arange(3,4.1,1), 'b--',

label='ax2 ax2 ax2 ax2', zorder=22)

gr2 = ax2.grid(zorder=23)

# legend of the right y-axes, force high zorder

leg2 = ax2.legend(loc='upper right')

leg2.set_zorder(40)

print '=== zorder:'

print ' ax1: %i' % ax1.get_zorder()

print ' ax2: %i' % ax2.get_zorder()

print 'leg1: %i' % leg1.get_zorder()

print 'leg2: %i' % leg2.get_zorder()


What am I missing here?
Thanks,
David



--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] move legend to the foreground

2012-03-22 Thread David Verelst
Hi All,

I am plotting on two different y-axes: one on the left (ax1) and one on 
the right (ax2). Both share the same x-axes. The problem I am facing 
relates back to the zorder of the legend (at least, that is what I 
think): I want it to be on the foreground at all times. In order to do 
so, I change the zorder of the ax1.legend (left y axes) such that the 
ax2.plots (right y-axes) are under ax1.legend. However, that doesn't 
work: all the plots on the right axes (so using ax2) end up above the 
legend 1 on the left, despite having a lower zorder.

Note that I am also giving the grids on both ax1 and ax2 a lower zorder 
value compared to the legends, but the grid still ends up on top of 
legend 1 on the left.

# version info:
# Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2
# NumPy 1.6.1, Matplotlib 1.1.0
import pylab as plt
import numpy as np

# plotting on the left y-axes,
ax1 = plt.axes(zorder=10)
ax1.plot(range(0,5,1), 'r', label='ax1 ax1 ax1 ax1', zorder=11)
ax1.plot(np.arange(3,4.1,1), 'r--', label='ax1 ax1 ax1 ax1', zorder=12)
gr1 = ax1.grid(zorder=13)

# legend of the left y-axes, force high zorder
leg1 = ax1.legend(loc='upper left')
leg1.set_zorder(30)

# plotting on the right y-axes,
ax2 = plt.twinx()
ax2.set_zorder(20)
ax2.plot(range(4,-1,-1), 'b', label='ax2 ax2 ax2 ax2', zorder=21)
ax2.plot(np.arange(4,2.9,-1), np.arange(3,4.1,1), 'b--',
label='ax2 ax2 ax2 ax2', zorder=22)
gr2 = ax2.grid(zorder=23)

# legend of the right y-axes, force high zorder
leg2 = ax2.legend(loc='upper right')
leg2.set_zorder(40)

print '=== zorder:'
print ' ax1: %i' % ax1.get_zorder()
print ' ax2: %i' % ax2.get_zorder()
print 'leg1: %i' % leg1.get_zorder()
print 'leg2: %i' % leg2.get_zorder()

What am I missing here?

Thanks,
David

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] 3d plotting

2012-03-18 Thread David Craig
Hi,
I'm using surface_plot to view the results of solving the 2d wave equation.
It works fine (code is below) except I would like to add a color bar and
fix the limits on the vertical axis. When I add the color bar a new one is
added in every iteration instead of overwriting the previous one, anyone
know how I can prevent this?
Also is it possible to specify a view point when plotting?
Thanks
D



import matplotlib.pyplot as plt
import numpy as np
import pylab as py
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm

pi = np.pi

#Set up grid.

fig = py.figure()
ax = Axes3D(fig)

nx = 50
nz = 50

X = np.arange(0, nx, 1)
Y = np.arange(0, nz, 1)
X, Y = np.meshgrid(X, Y)

nsteps = 100

# Constants for equation.
c = 4000
dt = 1e-4
h = 1


# Set up source.
xs = 0
zs = 0

#fig2 = py.figure()
ts = np.arange(dt,nsteps*dt,dt)
s = 0.5*np.sin(2*pi*100*ts)
#py.plot(ts,s)
#py.show()


# Homogeneous pressure field.
p = np.zeros([nx, nz, nsteps])

# Solve equation.
for t in range(0,nsteps-1):


for z in range(0,nz-1):

for x in range(0,nx-1):

p[xs,zs,t] = s[t]

k = (c*dt/h)**2

p[x,z,t] = 2*p[x,z,t-1] - p[x,z,t-2] +
k*(p[x+1,z,t-1]-4*p[x,z,t-1]+p[x-1,z,t-1]+p[x,z+1,t-1]+p[x,z-1,t-1])

snap = p[:,:,t]
surf = ax.plot_surface(X,Y,snap, rstride=1, cstride=1, cmap=cm.jet,
linewidth=0)
#fig.colorbar(surf, shrink=0.5, aspect=5)
#py.draw()
py.savefig('/home/davcra/Desktop/plots/2Dwave/'+str(t))
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Figure save hack

2012-03-16 Thread David Verelst
Hi,

This sounds actually very interesting. I have been thinking about how to 
save matplotlib figures in a way comparable to the Matlab .fig format: a 
file that holds the data (for instance using HDF5/pytables, some figures 
might hold a lot of data) and the plotting commands to exactly 
reconstruct the figure. However, I never got around of thinking about an 
actual implementation for Matplotlib. Hopefully your work can inspire me 
to actually get it started , and I will try to find some time to dig in 
your code the coming weeks.

At the Spyder mailing list the idea of saving figures a la Matlab 
briefly popped before as well: 
http://groups.google.com/group/spyderlib/browse_thread/thread/bf582bac96ff875/d5e94fe9296afbe5
 


I think saving figures in this manner would be a nice feature for 
matplotlib.

Thanks for sharing this!

Regards,
David

PS: sorry to Sebastian for sending the message twice

On 15/03/12 11:22, Sebastian Berg wrote:
 Hey,

 last weekend I wrote a hook which can track figure creation. Basically
 it takes care of creating the new figure and wraps it to track all
 changes to it. Its a hack, and the code is not cleaned up or tested
 much, but I like to do scripts that I run with many parameters to create
 plots and it works well to allow me to open the figures in a way that I
 can zoom, etc. and would allow editing (a bit) later on too. So while I
 doubt the approach can be made something serious, and there are probably
 things that don't work (right now 3D Axis can be done with a bit extra
 but mouse zooming does not work inside a 3D Axis, though I think its
 likely not difficult to change), I thought I would put it online because
 I am not aware of any way to save matplotlib figures:

 https://github.com/seberg/haunter-for-matplotlib-figures

 Maybe someone finds it useful or interesting :)

 Regards,

 Sebastian Berg


 --
 This SF email is sponsosred by:
 Try Windows Azure free for 90 days Click Here
 http://p.sf.net/sfu/sfd2d-msazure
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] draw lines in basemap

2012-02-29 Thread David Craig
Hi,
I'm trying to produce a map with 12 locations marked on it and straight 
lines plotted between each point and all other points on the map. I have 
the map with the locations ok but am having trouble getting the lines. 
My code is below anyone know how to do this??
Thanks
D

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.lines as lines
import numpy as np

m = Basemap(llcrnrlon=-11.5,llcrnrlat=51.0,urcrnrlon=-4.5,urcrnrlat=56.0,
 resolution='i',projection='cass',lon_0=-4.36,lat_0=54.7)

lats = [53.5519317,53.8758499, 54.2894659, 55.2333142, 
54.9846137,54.7064869, 51.5296651, 51.5536226, 51.7653115, 52.1625237, 
52.5809163, 52.9393892]

lons = [-9.9413447, -9.9621948, -8.9583439, -7.6770179, -8.3771698, 
-8.7406732, -8.9529546, -9.7907148, -10.1531573, -10.4099873, 
-9.8456417, -9.4344939]

x, y = m(lons, lats)
for i in range(len(lons)):
 for j in range(len(lons)):
 if i == j: continue
 m.plot([x[i],y[i]],[x[j],y[j]],'k')

m.plot(x, y, 'bD', markersize=10)
m.drawcoastlines()
#m.drawmapboundary()
#plt.savefig('/media/A677-86E0/dot_size'+str(i)+'.png')
plt.show()


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] basemap problem

2012-02-26 Thread David Craig
Hi, I recently installed basemap and python imaging library on my laptop. I
have an i686 machine with fedora 16 on it. I just tried some test plots and
basemap seems to work fine but according to the documentation to use the
bluemarble(), etopo(), shadedrelief() and warpimage() instance methods I
need PIL. SO I installed it via yum,

$ sudo yum install python-imaging.i686

however only the bluemarble method works. If I try any of the others I get
the following error.

AttributeErrorTraceback (most recent call last)
/usr/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in
execfile(fname, *where)
173 else:
174 filename = fname
-- 175 __builtin__.execfile(filename, *where)

/home/davcra/Desktop/python_scripts/blue_marble.py in module()
 10
 11
--- 12 m.shadedrelief()
 13 plt.show()

AttributeError: 'Basemap' object has no attribute 'shadedrelief'

Anyone know what I did wrong
Thanks
David
--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] surface plot

2012-02-23 Thread David Craig
Hi,
I have an array defined by 3 variables p(x,z,t). I would like to produce 
a surface plot with colors defined by p and animate it. That is plot the 
value of p at all x and z, over time (t).  My code to get p is below but 
I really have no idea how to plot this. Anyone know the best way to go 
about this?
thanks,
D


# 2D Finite Distance Wave Equation.
from pylab import *
from numpy import math

ion()

# Set up variables.
nx = 100
nz = 100
nsteps = 300
c = 3500
dt = 10**-4
h = 1
t = arange(0,nsteps,dt)

# Define source as a spike.
s = zeros(nsteps)
s[1] = 1
s[2] = 2
s[3] = 1

# Position source.
xs = 50
zs = 50
##plot(t,s)
##show()


# Set up pressure field.
p=empty([nx,nz,nsteps])

for t in range(0,nsteps-1):

 for z in range(0,nz-1):

 for x in range(0,nx-1):

 p[x,z,t] = 0



# Solve wave equation.
for t in range(2,nsteps-1):


 for z in range(1,nz-1):

 for x in range(2,nx-1):

 p[xs,zs,t] = s[t]

 k = (c*dt/h)**2

 p[x,z,t] = 2*p[x,z,t-1] - p[x,z,t-2] + 
k*(p[x+1,z,t-1]-4*p[x,z,t-1]+p[x-1,z,t-1]+p[x,z+1,t-1]+p[x,z-1,t-1])


 #Plot somehow
 draw()
#close()



--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] x-axis ticks and labels

2012-02-09 Thread David Craig
Hi,
I am trying to relabel the x-axis on a plot. I want it to have 10 evenly 
spaced labels ranging from 274 at zero to 283 at one increment short of 
the axis. My code is as follows:

 im.axes.xaxis.set_major_locator(py.MaxNLocator(10))
 im.axes.xaxis.set_ticklabels(range(274,284))

My understanding is that MaxNLocator defines the number of spaces 
between labels. I've tried a few variations on the above but can only 
seem to get the last label to be 282 or 284. Anyone know what I am doing 
wrong.
Thanks
D

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] add a single x tick label

2012-02-08 Thread David Craig
Hi, I have a plot of a time series and I would like to add a single 
extra tick mark and label to the plot in a different color to the 
already existing tick marks. Is this possible??
Thanks,
D

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Change xaxis labels

2012-02-06 Thread David Craig
Hi, I have a plot and the xaxis shows number of seconds after a start 
point. I would like to convert them to days anyone know how to do this. 
I have looked at the documentation but cant find what I need.

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] specgram memory problem

2012-02-06 Thread David Craig
I'm using a lenovo laptop with fedora 16. It has 2.9 GiB memory and 4  
intel core CPUs @ 2.3GHz each. Available disk space is 147.9GiB.
numpy 1.6.0
matplotlib 1.0.1


On 6 Feb 2012, at 10:29, Fabrice Silva wrote:

 On Sat, Feb 4, 2012 at 9:44 AM, Fabrice Silva si...@lma.cnrs- 
 mrs.fr wrote:
 Le vendredi 03 février 2012 à 17:39 +, David Craig a  
 écrit :
 sure how to get it to plot the outputs from specgram. I use
 specgram as follows,
 Pxx, freqs, bins, im = plt.specgram(..)
 what am I trying imshow??


 plt.specgram computes the spectrogram and when calls  
 imshow to display
 the resulting array into an image

 Please tell the shape of Pxx, and try the following

 import numpy as np
 import matplotlib.pyplot as plt
 a = np.empty((12000, 14400), dtype=float)
 plt.imshow(a)
 plt.show()

 Le samedi 04 février 2012 à 10:30 +, David Craig a écrit :
 Pxx has shape (6001, 1430) and when I tried the lines of code it  
 returned the following memory error,

 Traceback (most recent call last):
   File /usr/lib/python2.7/site-packages/matplotlib/backends/ 
 backend_gtk.py, line 394, in expose_event
 self._render_figure(self._pixmap, w, h)
   File /usr/lib/python2.7/site-packages/matplotlib/backends/ 
 backend_gtkagg.py, line 75, in _render_figure
 FigureCanvasAgg.draw(self)
   File /usr/lib/python2.7/site-packages/matplotlib/backends/ 
 backend_agg.py, line 394, in draw
 self.figure.draw(self.renderer)
   File /usr/lib/python2.7/site-packages/matplotlib/artist.py,  
 line 55, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File /usr/lib/python2.7/site-packages/matplotlib/figure.py,  
 line 798, in draw
 func(*args)
   File /usr/lib/python2.7/site-packages/matplotlib/artist.py,  
 line 55, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File /usr/lib/python2.7/site-packages/matplotlib/axes.py, line  
 1946, in draw
 a.draw(renderer)
   File /usr/lib/python2.7/site-packages/matplotlib/artist.py,  
 line 55, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File /usr/lib/python2.7/site-packages/matplotlib/image.py,  
 line 354, in draw
 im = self.make_image(renderer.get_image_magnification())
   File /usr/lib/python2.7/site-packages/matplotlib/image.py,  
 line 569, in make_image
 transformed_viewLim)
   File /usr/lib/python2.7/site-packages/matplotlib/image.py,  
 line 201, in _get_unsampled_image
 x = self.to_rgba(self._A, self._alpha)
   File /usr/lib/python2.7/site-packages/matplotlib/cm.py, line  
 193, in to_rgba
 x = self.norm(x)
   File /usr/lib/python2.7/site-packages/matplotlib/colors.py,  
 line 802, in __call__
 val = ma.asarray(value).astype(np.float)
   File /usr/lib/python2.7/site-packages/numpy/ma/core.py, line  
 2908, in astype
 output = self._data.astype(newtype).view(type(self))
 MemoryError

 Please, answer on the mailing list,
 It confirms that the troubles lie in the rendering of images. Could  
 you
 tell the versions of numpy and matplotlib you are using, and the
 characteristics of the computer you are working on ?


 -- 
 
 Try before you buy = See our experts in action!
 The most comprehensive online learning library for Microsoft  
 developers
 is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3,  
 MVC3,
 Metro Style Apps, more. Free future releases when you subscribe now!
 http://p.sf.net/sfu/learndevnow-dev2
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] specgram memory problem

2012-02-06 Thread David Craig
uname -a gives,
Linux David 3.2.2-1.fc16.i686 #1 SMP Thu Jan 26 03:38:31 UTC 2012 i686 i686
i386 GNU/Linux

On Mon, Feb 6, 2012 at 6:07 PM, Benjamin Root ben.r...@ou.edu wrote:



 On Mon, Feb 6, 2012 at 11:59 AM, David Craig dcdavem...@gmail.com wrote:

 I'm using a lenovo laptop with fedora 16. It has 2.9 GiB memory and 4
 intel core CPUs @ 2.3GHz each. Available disk space is 147.9GiB.
 numpy 1.6.0
 matplotlib 1.0.1


 32-bit or 64-bit OS?  Please use 'uname -a' to tell us, because you can
 install a 32-bit OS on a 64-bit machine.

 Ben Root


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] specgram memory problem

2012-02-03 Thread David Craig
Hi, I am using matplotlib to produce some spectrograms for seismic data. I
am looking at a 10 day period with a sample rate of 20sps. I would like to
have my spectrogram to be composed of 10 minute windows with an overlap of
90%. However when I try and run my script I run out of memory. I can
produce the spectrogram for a maximum of 3 days before an error occurs.
I have also tried to produce a spectrogram for each day and stick them
together using subplot, but I then get the error given below. Anyone know a
way around this??
Thanks,
David

Traceback (most recent call last):
  File
/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py, line
394, in expose_event
self._render_figure(self._pixmap, w, h)
  File
/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py,
line 75, in _render_figure
FigureCanvasAgg.draw(self)
  File
/usr/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py, line
394, in draw
self.figure.draw(self.renderer)
  File /usr/lib/python2.7/site-packages/matplotlib/artist.py, line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File /usr/lib/python2.7/site-packages/matplotlib/figure.py, line 798,
in draw
func(*args)
  File /usr/lib/python2.7/site-packages/matplotlib/artist.py, line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File /usr/lib/python2.7/site-packages/matplotlib/axes.py, line 1946, in
draw
a.draw(renderer)
  File /usr/lib/python2.7/site-packages/matplotlib/artist.py, line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File /usr/lib/python2.7/site-packages/matplotlib/image.py, line 354, in
draw
im = self.make_image(renderer.get_image_magnification())
  File /usr/lib/python2.7/site-packages/matplotlib/image.py, line 569, in
make_image
transformed_viewLim)
  File /usr/lib/python2.7/site-packages/matplotlib/image.py, line 201, in
_get_unsampled_image
x = self.to_rgba(self._A, self._alpha)
  File /usr/lib/python2.7/site-packages/matplotlib/cm.py, line 194, in
to_rgba
x = self.cmap(x, alpha=alpha, bytes=bytes)
  File /usr/lib/python2.7/site-packages/matplotlib/colors.py, line 551,
in __call__
rgba = np.empty(shape=xa.shape+(4,), dtype=lut.dtype)
MemoryError
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] specgram

2012-02-01 Thread David Craig
Hi, I am trying to produce a spectrogram for my data set and am having 
an issue with the color map. My data is filtered between 0.02 and 1.0Hz, 
but specgram() produces an image in the range 0 to 10Hz. Also the color 
map is not set properly. I would like to have it so the colormap ranges 
from the min and max powers obtained by specgram. Anyone know how to do 
this? My code is below.

Pxx, freqs, bins, im = plt.specgram(data, NFFT=nfft, Fs=sps, 
detrend=py.detrend_none, window=py.window_hanning, noverlap=nfft/2, 
cmap=None, xextent=None, pad_to=None, sides='default', scale_by_freq=None)
plt.ylim(0,1)
plt.colorbar()
plt.show()

thanks,
D

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] seconds to julian time

2012-02-01 Thread David Craig
Hi,
I have a plot that covers a 10 day period on its x-axis in seconds. I 
would like to change it to julian days, is this possible with matplotlib 
and if so how do I do it??
D

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] psd

2012-01-30 Thread David Craig
Hi I have some data for a 24hr period with a sample rate of 100
samples/second. I want to create a power spectrum using matplotlibs
function psd. I want it to have 10 minute windows with a 50% overlap, but
cant seem to get the syntax right. My code is as follows:

NFFT = len(data)
Fs = 100
window=np.hanning(Fs*60*10)
noverlap = window*0.5
plt.psd(data, NFFT, Fs, window, noverlap )

anyone kow how to do this properly???

Thanks,
D
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] psd

2012-01-30 Thread David Craig
Hi, thanks for that. I've made the following changes:

NFFT = 100*60*10# Linked to window size
Fs = stream[0].stats.sampling_rate
win = np.hanning(NFFT)
overlap = NFFT/2
power, freq = plt.psd(data, NFFT, Fs, win, overlap)

but it returns the following error:

Traceback (most recent call last):
  File /home/davcra/Desktop/python_scripts/welchPSD.py, line 20, in
module
power, freq = plt.psd(data, NFFT, Fs, win, overlap)
  File /usr/lib/python2.7/site-packages/matplotlib/pyplot.py, line 2322,
in psd
ret = ax.psd(x, NFFT, Fs, Fc, detrend, window, noverlap, pad_to, sides,
scale_by_freq, **kwargs)
  File /usr/lib/python2.7/site-packages/matplotlib/axes.py, line 7876, in
psd
sides, scale_by_freq)
  File /usr/lib/python2.7/site-packages/matplotlib/mlab.py, line 389, in
psd
scale_by_freq)
  File /usr/lib/python2.7/site-packages/matplotlib/mlab.py, line 419, in
csd
noverlap, pad_to, sides, scale_by_freq)
  File /usr/lib/python2.7/site-packages/matplotlib/mlab.py, line 268, in
_spectral_helper
thisX = windowVals * detrend(thisX)
TypeError: 'int' object is not callable


On Mon, Jan 30, 2012 at 12:13 PM, Fabrice Silva si...@lma.cnrs-mrs.frwrote:

 Le lundi 30 janvier 2012 à 11:45 +, David Craig a écrit :
  Hi I have some data for a 24hr period with a sample rate of 100
  samples/second. I want to create a power spectrum using matplotlibs
  function psd. I want it to have 10 minute windows with a 50% overlap,
  but cant seem to get the syntax right. My code is as follows:
 
  NFFT = len(data)
  Fs = 100
  window=np.hanning(Fs*60*10)
  noverlap = window*0.5
  plt.psd(data, NFFT, Fs, window, noverlap )
 
  anyone kow how to do this properly???

 Be careful to use a suitable value for NFFT. It must be linked to your
 windows size, not the total data length, and you would rather use a
 power of 2 for efficience. Do not use it to increase the frequency
 resolution (use pad_to instead).

 Fs = 100
 NFFT = Fs*60*10
 Pxx, f = plt.psd(data, NFFT, Fs, window=np.hanning(NFFT), NFFT/2)

 --
 Fabrice Silva



 --
 Try before you buy = See our experts in action!
 The most comprehensive online learning library for Microsoft developers
 is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
 Metro Style Apps, more. Free future releases when you subscribe now!
 http://p.sf.net/sfu/learndevnow-dev2
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Grid problem?

2012-01-18 Thread David Perlman
When I try to turn on the grid for just one axis, seemingly in perfect 
accordance with the documentation at 
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.grid

it seems like there is a problem.

My commands are pasted below.

Am I doing this wrong?  I am doing the best I can to follow the documentation 
exactly.

Thanks for any help!


import matplotlib
matplotlib.use('MacOSX')
import matplotlib.pyplot as plt
fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot([1,2,3])
ax.set_xlabel('Hi there')
ax.grid(True, axis='x')


bombayduck:~$ python
Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type help, copyright, credits or license for more information.
 import matplotlib
 matplotlib.use('MacOSX')
 import matplotlib.pyplot as plt
 fig=plt.figure()
 ax=fig.add_subplot(111)
 ax.plot([1,2,3])
[matplotlib.lines.Line2D object at 0x1a27e30]
 ax.set_xlabel('Hi there')
matplotlib.text.Text object at 0x1a58030
 ax.grid(True, axis='x')
Traceback (most recent call last):
  File stdin, line 1, in module
  File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py,
 line 1823, in grid
self.xaxis.grid(b, **kwargs)
  File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py,
 line 965, in grid
if len(kwargs): artist.setp(tick.gridline,**kwargs)
  File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py,
 line 1169, in setp
func = getattr(o,funcName)
AttributeError: 'Line2D' object has no attribute 'set_axis'

-dave--
A neuroscientist is at the video arcade, when someone makes him a $1000 bet
on Pac-Man. He smiles, gets out his screwdriver and takes apart the Pac-Man
game. Everyone says What are you doing? The neuroscientist says Well,
since we all know that Pac-Man is based on electric signals traveling
through these circuits, obviously I can understand it better than the other
guy by going straight to the source!


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Grid problem?

2012-01-11 Thread David Perlman
When I try to turn on the grid for just one axis, seemingly in perfect 
accordance with the documentation at 
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.grid

it seems like there is a problem.  I am able to make a graph, but trying to 
turn on the grid for just one axis causes an error.

My commands are pasted below.

Am I doing this wrong?  I am doing the best I can to follow the documentation 
exactly.

Thanks for any help!


import matplotlib
matplotlib.use('MacOSX')
import matplotlib.pyplot as plt
fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot([1,2,3])
ax.set_xlabel('Hi there')
ax.grid(True, axis='x')


bombayduck:~$ python
Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type help, copyright, credits or license for more information.
 import matplotlib
 matplotlib.use('MacOSX')
 import matplotlib.pyplot as plt
 fig=plt.figure()
 ax=fig.add_subplot(111)
 ax.plot([1,2,3])
[matplotlib.lines.Line2D object at 0x1a27e30]
 ax.set_xlabel('Hi there')
matplotlib.text.Text object at 0x1a58030
 ax.grid(True, axis='x')
Traceback (most recent call last):
 File stdin, line 1, in module
 File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py,
 line 1823, in grid
   self.xaxis.grid(b, **kwargs)
 File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py,
 line 965, in grid
   if len(kwargs): artist.setp(tick.gridline,**kwargs)
 File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py,
 line 1169, in setp
   func = getattr(o,funcName)
AttributeError: 'Line2D' object has no attribute 'set_axis'

-dave--
A neuroscientist is at the video arcade, when someone makes him a $1000 bet
on Pac-Man. He smiles, gets out his screwdriver and takes apart the Pac-Man
game. Everyone says What are you doing? The neuroscientist says Well,
since we all know that Pac-Man is based on electric signals traveling
through these circuits, obviously I can understand it better than the other
guy by going straight to the source!


--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib 1.1 TypeError: a float is required problem

2012-01-06 Thread David Hoese
I experienced the same problem on the macosx backend, switched to Qt4Agg 
and no problems.

 import matplotlib
 matplotlib.use(Qt4Agg)

-Dave

On 1/6/12 10:08 AM, md...@stsci.edu wrote:
 I suspect this bug is specific to the macosx backend.  Can you switch to
 another backend and confirm it doesn't happen there?  (I can't reproduce
 it on Linux).

 Mike


--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib 1.1 TypeError: a float is required problem

2012-01-06 Thread David Hoese

Hi Ken,

You're getting that error because you probably don't have Qt4 installed 
on your Mac (I do).  I'm not sure what backends come with matplotlib and 
will work for you (maybe someone here knows).  You can use any of the 
following:


GTK GTKAgg GTKCairo CocoaAgg FltkAgg
MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template

Like Qt4, some of those may need to be installed.  I also have Gtk 
installed (never used it before) and GTKAgg works for me, but not 
GTK.  It's also important to know that not all of those backends are 
interactive (they don't all show a window) and the figure must be saved 
to a file.


Also make sure that the 2 lines I provided need to be BEFORE any other 
matplotlib/pyplot imports.  Hope you find something that works for you, 
at least until the macosx bug is fixed.  I'm not an expert, sorry.


-Dave

On 1/6/12 10:35 AM, Mingkui Li wrote:

Hi, Dave,

I tried the two lines of code you posted, but when I ran the example I 
mentioned above I got such error:


ImportError: No module named sip

Seems I can't import any other libs from matplotlib after 
matplotlib.use(Qt4Agg)


I'm kind of a newbie, sorry.

Ken


On Sat, Jan 7, 2012 at 12:22 AM, David Hoese dho...@gmail.com 
mailto:dho...@gmail.com wrote:


I experienced the same problem on the macosx backend, switched to
Qt4Agg
and no problems.

import matplotlib
matplotlib.use(Qt4Agg)

-Dave

On 1/6/12 10:08 AM, md...@stsci.edu mailto:md...@stsci.edu wrote:
 I suspect this bug is specific to the macosx backend.  Can you
switch to
 another backend and confirm it doesn't happen there?  (I can't
reproduce
 it on Linux).

 Mike



--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a
complex
infrastructure or vast IT resources to deliver seamless, secure
access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI
infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
mailto:Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users




--
Mingkui Li



--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib on OS X Lion or FreeBSD

2012-01-03 Thread David Welch
Paul, 

Have you tried using virtualenv with Python 2.7?  I'm in the same situation and 
I find using a virtual environment for different configuration schemes allows 
me to have the up-to-date Python modules without the Mac's semi-legacy Python 
version.  It's fairly simple to set up - if you're interested I can discuss the 
details with you.

Cheers,
Dave 


David Welch
david.m.we...@gmail.com

Something you entered
transcended parameters.
So much is unknown.

-Salon Magazine, Error Haiku Challenge


On 29Dec, 2011, at 9:15 AM, Paul Beard wrote:

 This is turning out to be complicated. Is there any easier way? 
 
 It may be something as simple as a damaged archive, as this doesn't look 
 right: 
 
 [/home/paul/src/basemap-1.0.2]:: find . -name setup.py
 (p...@shuttle.paulbeard.org)-(07:02 AM / Thu Dec 29)
 
 It makes this step difficult: 
 3) cd back to the top level basemap directory (basemap-X.Y.Z) and
 run the usual 'python setup.py install'.  Check your installation
 by running from mpl_toolkits.basemap import Basemap at the python
 prompt.
 
 I have tried easy-install (it wasn't). I have tried pulling from git:
 python setup.py build
 Traceback (most recent call last):
   File setup.py, line 42, in module
 from setupext import build_agg, build_gtkagg, build_tkagg,\
   File /usr/home/paul/src/matplotlib/setupext.py, line 184, in module
 basedirlist = basedir[sys.platform]
 KeyError: 'freebsd8'
 
 I tried the packaged version on OS X Lion: 
 
 Screen Shot 2011-12-29 at 6.59.57 AM.png
 
 Built for OS X 10.3? Really? 
 
 I'm not installing fink or macports or homebrew: if it doesn't install from 
 source without a duplicated file hierarchy I'm not interested.
 
 Any hope here? 
 
 --
 Paul Beard
 
 Are you trying to win an argument or solve a problem? 
 
 --
 Write once. Port to many.
 Get the SDK and tools to simplify cross-platform app development. Create 
 new or port existing apps to sell to consumers worldwide. Explore the 
 Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
 http://p.sf.net/sfu/intel-appdev___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to do million data-point plots with Matplotlib?

2011-12-16 Thread David Smith
I have experimented with path.simplify and can't see any appreciable
improvements.

Incidently, I also experimented with other back ends.  I found that all the
back ends
involving Agg behave similarly.  However, using the 'GTK' backend it
renders the
whole 1 million points and does it very fast (about 5x faster than Agg
backends).

I also found that gnuplot can render the whole million points very fast
using the
'x11' terminal.  I am guessing that both matplotlib's GTK backend and
gnuplot's
'x11' terminal use the hardware accelerated display driver.

David
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib-users Digest, Vol 67, Issue 23

2011-12-15 Thread David Hoese
Eric,

I installed mpl from git (git clone 
git://github.com/matplotlib/matplotlib.git, unless I was suppose to use 
one of the branches) and same problem.  I looked at my code again and 
thought there should be a canvas.draw() before calling 
c.copy_from_bbox(a.bbox), but still the same problem.  However, I did 
have it work the first time I added c.draw() and used the git mpl, and 
by work I mean that everything stayed visible on the figure.

When people start coming in to my work I'll ask them to run my sample 
code and see what happens.  It almost seems like mpl is handling the 
window activation event funny, is there an easy way to print out the 
callbacks being used by a mpl figure?  For now, I will subclass 
QApplication, and implement notify() to print out events as they come 
in, but still...this is just weird.  Thanks.

-Dave

On 12/14/11 10:30 PM, Eric Firing wrote:
 David,

 It works for me on linux with mpl from git.  I haven't tried to figure
 it out, but it is conceivable that the problem you are seeing was fixed
 with this:

 commit b624546ae60dc5878e75a32f41a160d383548b8f
 Author: Eric Firingefir...@hawaii.edu
 Date:   Tue Oct 18 08:06:21 2011 -1000

   backend_qt4agg: draw() immediately calls FigureCanvasAgg.draw()

   This is the latest in a series of modifications to the Qt4Agg
   drawing strategy going back several years.  It simplifies the
   code and should solve the problem introduced in 6938b0025; that
   is, delaying the Agg draw operation until the paintEvent breaks
   code expecting that draw operation to have occurred immediately.
   The problem was reported here:
   http://sourceforge.net/mailarchive/message.php?msg_id=28245744

 Eric


--
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Blitting with qt4

2011-12-15 Thread David Hoese
Oops forgot to change subject.

On 12/15/11 10:02 AM, David Hoese wrote:
 Eric,

 I installed mpl from git (git clone 
 git://github.com/matplotlib/matplotlib.git, unless I was suppose to 
 use one of the branches) and same problem.  I looked at my code again 
 and thought there should be a canvas.draw() before calling 
 c.copy_from_bbox(a.bbox), but still the same problem.  However, I 
 did have it work the first time I added c.draw() and used the git 
 mpl, and by work I mean that everything stayed visible on the figure.

 When people start coming in to my work I'll ask them to run my sample 
 code and see what happens.  It almost seems like mpl is handling the 
 window activation event funny, is there an easy way to print out the 
 callbacks being used by a mpl figure?  For now, I will subclass 
 QApplication, and implement notify() to print out events as they 
 come in, but still...this is just weird.  Thanks.

 -Dave

 On 12/14/11 10:30 PM, Eric Firing wrote:
 David,

 It works for me on linux with mpl from git.  I haven't tried to figure
 it out, but it is conceivable that the problem you are seeing was fixed
 with this:

 commit b624546ae60dc5878e75a32f41a160d383548b8f
 Author: Eric Firingefir...@hawaii.edu
 Date:   Tue Oct 18 08:06:21 2011 -1000

   backend_qt4agg: draw() immediately calls FigureCanvasAgg.draw()

   This is the latest in a series of modifications to the Qt4Agg
   drawing strategy going back several years.  It simplifies the
   code and should solve the problem introduced in 6938b0025; that
   is, delaying the Agg draw operation until the paintEvent breaks
   code expecting that draw operation to have occurred immediately.
   The problem was reported here:
   http://sourceforge.net/mailarchive/message.php?msg_id=28245744

 Eric



--
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Blitting with qt4

2011-12-15 Thread David Hoese
Eric,

Good news I think I got it to work.  So using the same code I sent you 
originally, I applied the following changes:
1. Install matplotlib from git (this did fix things that I wasn't noticing)
2. Add c.draw() before c.copy_from_bbox
3. Copy f.bbox instead of a.bbox (I think this makes sense since I 
want it to hold on to the title,ticks, and labels, a.bbox is only the 
content inside the axis rectangle)
4. Restore f_bbox, blit f.bbox.

...and it seems to work.  The git version of mpl did fix this, although 
restoring just the a.bbox was only keeping the axis rectangle so it made 
it look like even worse of a bug.  Using the new version I noticed this 
and then started using f.bbox which seems to work the way I want it.

Now, my final question is: Is this actually doing what I want 
performance-wise.  When I blit just f.bbox, is it really only repainting 
the updated line or is it redrawing most of the figure?  If you need a 
copy of the new version of my test code let me know.  Thanks for any 
more clarity/help you can give.

-Dave

P.S. Is there a book or tutorial or website where I can learn more about 
how the rendering/painting of stuff like this works.  For example, if I 
could better understand why your bug fix was needed.

On 12/15/11 10:04 AM, David Hoese wrote:
 Oops forgot to change subject.

 On 12/15/11 10:02 AM, David Hoese wrote:
 Eric,

 I installed mpl from git (git clone 
 git://github.com/matplotlib/matplotlib.git, unless I was suppose to 
 use one of the branches) and same problem.  I looked at my code again 
 and thought there should be a canvas.draw() before calling 
 c.copy_from_bbox(a.bbox), but still the same problem.  However, I 
 did have it work the first time I added c.draw() and used the git 
 mpl, and by work I mean that everything stayed visible on the figure.

 When people start coming in to my work I'll ask them to run my sample 
 code and see what happens.  It almost seems like mpl is handling the 
 window activation event funny, is there an easy way to print out the 
 callbacks being used by a mpl figure?  For now, I will subclass 
 QApplication, and implement notify() to print out events as they 
 come in, but still...this is just weird.  Thanks.

 -Dave

 On 12/14/11 10:30 PM, Eric Firing wrote:
 David,

 It works for me on linux with mpl from git.  I haven't tried to figure
 it out, but it is conceivable that the problem you are seeing was fixed
 with this:

 commit b624546ae60dc5878e75a32f41a160d383548b8f
 Author: Eric Firingefir...@hawaii.edu
 Date:   Tue Oct 18 08:06:21 2011 -1000

   backend_qt4agg: draw() immediately calls FigureCanvasAgg.draw()

   This is the latest in a series of modifications to the Qt4Agg
   drawing strategy going back several years.  It simplifies the
   code and should solve the problem introduced in 6938b0025; that
   is, delaying the Agg draw operation until the paintEvent breaks
   code expecting that draw operation to have occurred immediately.
   The problem was reported here:
   http://sourceforge.net/mailarchive/message.php?msg_id=28245744

 Eric




--
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How can I place a table on a plot in Matplotlib?

2011-12-15 Thread David Grudoski
I'm not having any success in getting the matplotlib table commands to work. 
Here's an example of what I'd like to do:

Can anyone help with the table construction code? Thanks

import pylab as plt

plt.figure()
ax=plt.gca()
y=[1,2,3,4,5,4,3,2,1,1,1,1,1,1,1,1]
plt.plot([10,10,14,14,10],[2,4,4,2,2],'r')
col_labels=['col1','col2','col3']
row_labels=['row1','row2','row3']
table_vals=[11,12,13,21,22,23,31,32,33]
# the rectangle is where I want to place the table
plt.text(11,4.1,'Table Title',size=8)
plt.plot(y)
plt.show()

--
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [ploting data] Live data

2011-12-14 Thread David Hoese
I'm not sure how experienced you are with multithreaded programs, but 
here is some sample code (I mentioned it can get complicated).  I 
suggest you research Qt4 QThreads and also Qt4 Signals and slots to 
better understand the code below.  It is a working sample so you should 
be able to run it in a terminal and notice that the GUI is responsive 
and that you have messages being printed out on the terminal.  The code 
I provided below is more complicated than you may need for a 
proof-of-concept kind of program, but if you will be communicating with 
physical devices I suggest something like this.  I am by no means and 
expert, but I have been doing something similar to what you are doing.  
I also suggest maybe separating the device communication into another 
module/class, especially if others are going to (re)use your code.

Good Luck,
Dave

P.S. There are a lot of Qt4/PyQt4 threading examples online, but not all 
of them correct.  What I posted below is what I have found to be 
considered correct by most people.

#
### Sample Code ###
#

import time
from PyQt4 import QtGui,QtCore

class MyWindow(QtGui.QWidget):
 def __init__(self):
 QtGui.QWidget.__init__(self)

 # Sample GUI elements to test responsiveness
 the_choices = [item]*20
 self.choices = QtGui.QComboBox()
 self.choices.addItems(the_choices)
 self.layout = QtGui.QVBoxLayout(self)
 self.layout.addWidget(self.choices)
 self.setLayout(self.layout)

 def handle_new_data(self):
 # This is where you could redraw any matplotlib plots
 # Maybe send data through the signal/slot connection
 print Updating data

class MyInstrument(QtCore.QObject):
 signal_new_data = QtCore.pyqtSignal(name=signal_new_data)
 signal_closing = QtCore.pyqtSignal(name=signal_closing)
 def run(self):
 self._timer = QtCore.QTimer()
 self._timer.timeout.connect(self._run)
 self._timer.start(0)

 def _run(self):
 time.sleep(1)
 print Running the instrument function
 time.sleep(1)
 self.signal_new_data.emit()

 def close(self):
 print Closing instrument thread
 self._timer.stop()
 # Redundant timer stop
 self._timer.timeout.disconnect()
 self.signal_closing.emit()

if __name__ == __main__:
 app = QtGui.QApplication([ ])
 w = MyWindow()
 w.show()
 instrument = MyInstrument()
 instrument_thread = QtCore.QThread()
 instrument.moveToThread(instrument_thread)

 instrument_thread.started.connect(instrument.run)
 instrument.signal_new_data.connect(w.handle_new_data)

 # Make the close function run in the main thread so you can 
interrupt the sleeps
 app.lastWindowClosed.connect(instrument.close, 
QtCore.Qt.DirectConnection)
 # You could also call quit manually after exec_() returns
 instrument.signal_closing.connect(instrument_thread.quit)

 instrument_thread.start()
 app.exec_()
 #instrument_thread.quit()

 print Waiting for instrument thread...
 instrument_thread.wait()
 print SUCCESS

##
### End of Sample Code ###
##

On 12/14/11 3:51 AM, Fabien Lafont wrote:
 I prefer to use the multi-thread method beacause it's easier for me
 and my colaborators to have the entire acquisition process at the same
 place. Until then I use a simple one but I hope to use a more complex
 one in few weeks ( put different voltages on different devices then
 measure many voltages or current). If I use the domino technique
 (call the next operation by the end of the previous) it can be complex
 to read and to edit. Thank you very much anyway!

 How can I write a multi-thread process? I've just tried to add
 qApp.processEvents() at the end of my while loop but it doesn't change
 anything...

 Thanks again,

 Fabien

 2011/12/13 David Hoesedho...@gmail.com:
 Yeah I didn't think about suggesting that, but I think it might get
 complicated.  I think he would have to start a one shot timer to call a
 function to set the voltage.  Then that function would also start another
 one shot timer to call another function that would read from the sample.
   That function then would start a one shot timer to call the first function
 again.  This way he can be sure that things are called in order and that
 timing is consistent, just in case the GUI gets complicated or something
 makes the event loop slow down.

 He could also use multiple threads.  Whatever works for Fabien I guess.

 -Dave

 On 12/13/11 1:00 PM, matplotlib-users-requ...@lists.sourceforge.net wrote:
 From: Drain, Theodore R (343P)theodore.r.dr...@jpl.nasa.gov

 Subject: Re: [Matplotlib-users] [ploting data] Live data

 Perhaps I'm missing something, but why not use QTimer?  You can't really
 every call sleep in a single threaded gui (for reasons you've encountered).
   If you need to poll something, create

Re: [Matplotlib-users] [ploting data] Live data

2011-12-14 Thread David Hoese
I don't know what you mean by ApplicationWindow, is that a class or 
just a name for the main GUI window.  I also don't really know what 
calling the graphical application means, but I'm sure the book can help 
you more than I can.  Again, good luck.

-Dave

On 12/14/11 10:17 AM, Fabien Lafont wrote:
 Thanks David, I start to read the Mark summerfield' book about PyQt
 programming.

 In fact I realized I don't need multi-threading because I can remove
 the Timer and just need to call the graphical application from the
 while loop.

 How can I call the ApplicationWindow class from my while loop? I'll
 try to read a bit more about PyQt to understand how it works :)

 thanks again!

 Fabien

 2011/12/14 David Hoesedho...@gmail.com:
 I'm not sure how experienced you are with multithreaded programs, but here
 is some sample code (I mentioned it can get complicated).  I suggest you
 research Qt4 QThreads and also Qt4 Signals and slots to better understand
 the code below.  It is a working sample so you should be able to run it in a
 terminal and notice that the GUI is responsive and that you have messages
 being printed out on the terminal.  The code I provided below is more
 complicated than you may need for a proof-of-concept kind of program, but if
 you will be communicating with physical devices I suggest something like
 this.  I am by no means and expert, but I have been doing something similar
 to what you are doing.  I also suggest maybe separating the device
 communication into another module/class, especially if others are going to
 (re)use your code.

 Good Luck,
 Dave

 P.S. There are a lot of Qt4/PyQt4 threading examples online, but not all of
 them correct.  What I posted below is what I have found to be considered
 correct by most people.

 #
 ### Sample Code ###
 #

 import time
 from PyQt4 import QtGui,QtCore

 class MyWindow(QtGui.QWidget):
 def __init__(self):
 QtGui.QWidget.__init__(self)

 # Sample GUI elements to test responsiveness
 the_choices = [item]*20
 self.choices = QtGui.QComboBox()
 self.choices.addItems(the_choices)
 self.layout = QtGui.QVBoxLayout(self)
 self.layout.addWidget(self.choices)
 self.setLayout(self.layout)

 def handle_new_data(self):
 # This is where you could redraw any matplotlib plots
 # Maybe send data through the signal/slot connection
 print Updating data

 class MyInstrument(QtCore.QObject):
 signal_new_data = QtCore.pyqtSignal(name=signal_new_data)
 signal_closing = QtCore.pyqtSignal(name=signal_closing)
 def run(self):
 self._timer = QtCore.QTimer()
 self._timer.timeout.connect(self._run)
 self._timer.start(0)

 def _run(self):
 time.sleep(1)
 print Running the instrument function
 time.sleep(1)
 self.signal_new_data.emit()

 def close(self):
 print Closing instrument thread
 self._timer.stop()
 # Redundant timer stop
 self._timer.timeout.disconnect()
 self.signal_closing.emit()

 if __name__ == __main__:
 app = QtGui.QApplication([ ])
 w = MyWindow()
 w.show()
 instrument = MyInstrument()
 instrument_thread = QtCore.QThread()
 instrument.moveToThread(instrument_thread)

 instrument_thread.started.connect(instrument.run)
 instrument.signal_new_data.connect(w.handle_new_data)

 # Make the close function run in the main thread so you can interrupt
 the sleeps
 app.lastWindowClosed.connect(instrument.close,
 QtCore.Qt.DirectConnection)
 # You could also call quit manually after exec_() returns
 instrument.signal_closing.connect(instrument_thread.quit)

 instrument_thread.start()
 app.exec_()
 #instrument_thread.quit()

 print Waiting for instrument thread...
 instrument_thread.wait()
 print SUCCESS

 ##
 ### End of Sample Code ###
 ##


 On 12/14/11 3:51 AM, Fabien Lafont wrote:
 I prefer to use the multi-thread method beacause it's easier for me
 and my colaborators to have the entire acquisition process at the same
 place. Until then I use a simple one but I hope to use a more complex
 one in few weeks ( put different voltages on different devices then
 measure many voltages or current). If I use the domino technique
 (call the next operation by the end of the previous) it can be complex
 to read and to edit. Thank you very much anyway!

 How can I write a multi-thread process? I've just tried to add
 qApp.processEvents() at the end of my while loop but it doesn't change
 anything...

 Thanks again,

 Fabien

 2011/12/13 David Hoesedho...@gmail.com:
 Yeah I didn't think about suggesting that, but I think it might get
 complicated.  I think he would have to start a one shot timer to call a
 function to set the voltage.  Then that function would also start another
 one shot timer to call another function

[Matplotlib-users] Blitting with qt4

2011-12-14 Thread David Hoese
Does anyone know if using the blit method from FigureCanvasQTAgg is not 
fully supported?  I'm having a problem where I'm animating a plot using 
the blit method and I click on/activate the window the background of the 
figure disappears (axes and line stay visible).  I'm not sure if this is 
just me (Mac OS X Lion, Qt4 4.8.6, Matplotlib 1.1.0), but the following 
code reproduces the error:

###
from PyQt4 import QtGui,QtCore
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
from time import sleep

app = QtGui.QApplication([ ])
f = Figure()
c = FigureCanvasQTAgg(f)
a = f.add_subplot(111)
a.set_title(A Title)
bbox = c.copy_from_bbox(a.bbox)
lines = a.plot([1,2,3],[1,2,3])
c.draw()
c.show()

wait = raw_input(Press a key to continue...)

def update(i):
 a.lines[0].set_ydata([i,1,i])
 print a.bbox.bounds
 c.restore_region(bbox, bbox=a.bbox)
 a.draw_artist(a.lines[0])
 c.blit(a.bbox)

 sleep(1)
 app.processEvents()

for i in range(20):
 update(i)

wait = raw_input(Press a key to continue...)
###

To see the problem, run the code, watch the plot to make sure its 
updating properly, then click on the window  to put it in focus/activate 
it.  I'm hoping that I'm just doing something stupid and its an easy 
fix.  It seems to work until I click on the window (in Mac OS X Lion 
Terminal the window is opened in the background and the Terminal window 
stays in focus).  Thanks for any help.

-Dave


--
Cloud Computing - Latest Buzzword or a Glimpse of the Future?
This paper surveys cloud computing today: What are the benefits? 
Why are businesses embracing it? What are its payoffs and pitfalls?
http://www.accelacomm.com/jaw/sdnl/114/51425149/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [ploting data] Live data

2011-12-13 Thread David Hoese
Fabien,

The GUI not being responsive might be my fault, I've never used a timer 
of 0 and processEvents().  I think what might be happening is that when
you call processEvents, the timer of 0 calls your principal function 
again, which calls processEvents again, and so on.  Try a timer of 2 
again, that should stop the timer from being constantly triggered. 
Later today, once I get to work, I'll run some tests of my own and 
figure out if that's really the problem.  Email me if you make any progress.

-Dave

On 12/13/2011 2:30 AM, Fabien Lafont wrote:
 Hey David,

 I'm doing this program to control an experiment, so I want to put the
 voltage on the sample, then wait two seconds to be sure there is no
 current fluctuations then measure the curent with multimeters and
 finally plot the datas. That's why I need the sleep... In fact I
 wanted to use in parallel the timer to refresh the graph and a while
 loop to extract the datas.

 If I use startTimer(0) it works but the GUI is almost unresponsive.
 I'm trying to use qApp.processEvents() but up to now I don't manage to
 see the window appears...

 Thanks again for your help

 Fabien



 2011/12/12 David Hoesedho...@gmail.com:
 Hey Fabien,

 So you made your principal function run on a timer every 2 seconds?  And by
 lag do you mean that the GUI is unresponsive?  I'm still not seeing when
 the loop stops, but what you can do is set the timer at a 0 interval so it
 will call the principal function as fast as it can (but with no loop).  The
 problem with this is that you have those 2 sleep calls in the function.  I'm
 not sure why you have the sleeps, but if you need them you have two choices:

 1. Make you GUI multi-threaded and you could emit a Qt signal from the data
 thread when the GUI thread needs to update the GUI.  Yes this could get
 complicated, but if the sleeps are required then its probably the best way.

 2. (From what I've been told, the Qt experts don't approve this) You can use
 app.processEvents() in your loop (after each sleep maybe) and this will
 pause your function and tell the main event loop to process any queued
 events (like GUI actions/events) which will make your GUI more responsive.

 If that doesn't make sense let me know.

 -Dave


 On 12/12/11 9:16 AM, Fabien Lafont wrote:

 Hi David! Sorry about the delay I was abroad and without any way to
 connect to the internet.

 Thank you very much. I've tried to put the principal inside the
 timerEvent. It work but it lags. In fact I've set the interval of the
 Timer to 2 seconds because the principal loop takes roughly 2seconds
 but it's not very accurate...

 Is there a way to do the principal loop, show it on the screen, then
 redo the loop?

 Thanks again!

 Fabien

 2011/12/5 David Hoesedho...@gmail.com:

 If I'm understanding your question correctly and reading your code
 correctly, you're asking why the timer method of doing things works, but 
 the
 principal() while loop method does not.

 I had a couple solutions that involved the main event loop, but I just
 noticed 2 main things that are probably wrong with your code:
 1. You are calling 'principal' from inside __init__ so you never actually
 return from __init__ which means that you never call window.show() and
 therefore never call qApp.exec_().  If you really want to use the
 'principal' method you would have to connect it to a one shot timer anyway
 to have it run after you have started the application ('qApp.exec_()').  I
 think the recommended way would be to use the timer the way you did in your
 latest email.

 2. At least in the way my email client reads your original code, your
 calls to the matplotlib drawing functions aren't inside the while loop and
 the while loop never ends...although this doesn't matter if you don't fix 
 #1
 above.

 Hope that made sense.

 -Dave


 On 12/5/11 1:44 PM, matplotlib-users-requ...@lists.sourceforge.net wrote:

 Message: 3
 Date: Mon, 5 Dec 2011 15:46:02 +0100
 From: Fabien Lafontlafont.fab...@gmail.com
 Subject: Re: [Matplotlib-users] [ploting data] Live data
 Cc:matplotlib-users@lists.sourceforge.net
 Message-ID:

 CAC9H_cjrgQBE6e6+jzZHyfYHonTeAg0XwU7c_2G-hu=s+z7...@mail.gmail.com
 Content-Type: text/plain; charset=ISO-8859-1

 Thx all for your remarks,

 I can't understand why this code works (when I use the timer method):



 --
 All the data continuously generated in your IT infrastructure
 contains a definitive record of customers, application performance,
 security threats, fraudulent activity, and more. Splunk takes this
 data and makes sense of it. IT sense. And common sense.
 http://p.sf.net/sfu/splunk-novd2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Systems Optimization Self

Re: [Matplotlib-users] [ploting data] Live data

2011-12-13 Thread David Hoese
Yeah I didn't think about suggesting that, but I think it might get 
complicated.  I think he would have to start a one shot timer to call a 
function to set the voltage.  Then that function would also start 
another one shot timer to call another function that would read from the 
sample.  That function then would start a one shot timer to call the 
first function again.  This way he can be sure that things are called in 
order and that timing is consistent, just in case the GUI gets 
complicated or something makes the event loop slow down.

He could also use multiple threads.  Whatever works for Fabien I guess.

-Dave

On 12/13/11 1:00 PM, matplotlib-users-requ...@lists.sourceforge.net wrote:
 From: Drain, Theodore R (343P)theodore.r.dr...@jpl.nasa.gov
 Subject: Re: [Matplotlib-users] [ploting data] Live data

 Perhaps I'm missing something, but why not use QTimer?  You can't really 
 every call sleep in a single threaded gui (for reasons you've encountered).  
 If you need to poll something, create a QTimer for 2 seconds and have it call 
 a measurement function to update the data.  You shouldn't need any 
 processEvents calls or sleep.


--
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and 
improve service delivery. Take 5 minutes to use this Systems Optimization 
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [ploting data] Live data

2011-12-12 Thread David Hoese
Hey Fabien,

So you made your principal function run on a timer every 2 seconds?  And 
by lag do you mean that the GUI is unresponsive?  I'm still not seeing 
when the loop stops, but what you can do is set the timer at a 0 
interval so it will call the principal function as fast as it can (but 
with no loop).  The problem with this is that you have those 2 sleep 
calls in the function.  I'm not sure why you have the sleeps, but if you 
need them you have two choices:

1. Make you GUI multi-threaded and you could emit a Qt signal from the 
data thread when the GUI thread needs to update the GUI.  Yes this could 
get complicated, but if the sleeps are required then its probably the 
best way.

2. (From what I've been told, the Qt experts don't approve this) You can 
use app.processEvents() in your loop (after each sleep maybe) and this 
will pause your function and tell the main event loop to process any 
queued events (like GUI actions/events) which will make your GUI more 
responsive.

If that doesn't make sense let me know.

-Dave

On 12/12/11 9:16 AM, Fabien Lafont wrote:
 Hi David! Sorry about the delay I was abroad and without any way to
 connect to the internet.

 Thank you very much. I've tried to put the principal inside the
 timerEvent. It work but it lags. In fact I've set the interval of the
 Timer to 2 seconds because the principal loop takes roughly 2seconds
 but it's not very accurate...

 Is there a way to do the principal loop, show it on the screen, then
 redo the loop?

 Thanks again!

 Fabien

 2011/12/5 David Hoesedho...@gmail.com:
 If I'm understanding your question correctly and reading your code 
 correctly, you're asking why the timer method of doing things works, but the 
 principal() while loop method does not.

 I had a couple solutions that involved the main event loop, but I just 
 noticed 2 main things that are probably wrong with your code:
 1. You are calling 'principal' from inside __init__ so you never actually 
 return from __init__ which means that you never call window.show() and 
 therefore never call qApp.exec_().  If you really want to use the 
 'principal' method you would have to connect it to a one shot timer anyway 
 to have it run after you have started the application ('qApp.exec_()').  I 
 think the recommended way would be to use the timer the way you did in your 
 latest email.

 2. At least in the way my email client reads your original code, your calls 
 to the matplotlib drawing functions aren't inside the while loop and the 
 while loop never ends...although this doesn't matter if you don't fix #1 
 above.

 Hope that made sense.

 -Dave


 On 12/5/11 1:44 PM, matplotlib-users-requ...@lists.sourceforge.net wrote:
 Message: 3
 Date: Mon, 5 Dec 2011 15:46:02 +0100
 From: Fabien Lafontlafont.fab...@gmail.com
 Subject: Re: [Matplotlib-users] [ploting data] Live data
 Cc:matplotlib-users@lists.sourceforge.net
 Message-ID:
CAC9H_cjrgQBE6e6+jzZHyfYHonTeAg0XwU7c_2G-hu=s+z7...@mail.gmail.com
 Content-Type: text/plain; charset=ISO-8859-1

 Thx all for your remarks,

 I can't understand why this code works (when I use the timer method):

 --
 All the data continuously generated in your IT infrastructure
 contains a definitive record of customers, application performance,
 security threats, fraudulent activity, and more. Splunk takes this
 data and makes sense of it. IT sense. And common sense.
 http://p.sf.net/sfu/splunk-novd2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to do million data-point plots with Matplotlib?

2011-12-10 Thread David Smith
I have been working on a program that uses Matplotlib to plot data
consisting of around one million points.  Sometimes the plots succeed but
often I get an exception: OverFlowError: Agg rendering complexity exceeded.

I can make this message go away by plotting the data in chunks as
illustrated in the demo code below.  However, the extra code is a chore
which I don't think should be necessary - I hope the developers will
be able to fix this issue sometime soon.  I know that the development
version has some modifications to addressing this issue.  I wonder if it is
expected to make the problem go away?

By the way, this plot takes about 30 seconds to render on my I7 2600k.
The main program reaches the show() statement quickly and prints
Done plotting?.   Then I see that the program reaches 100% usage
on one CPU core (4 real, 8 virtual on the 2600k) until the plot is
displayed.  I wonder if there is any way to persuade Matplotlib to run
some of the chunks in parallel so as to use more CPU cores?

Plotting something other than random data, the plots run faster and
the maximum chunk size is smaller.  The maximum chunk size
also depends on the plot size - it is smaller for larger plots.  I am
wondering if I could use this to plot course and fine versions of the
plots.  The course plot is zoomed in version of the small-sized raster.
That would be better than decimation as all the points would at least
be there.

Thanks in advance,

David

--- start code -
## Demo program shows how to chunk plots to avoid the exception:
##
##    OverflowError: Agg rendering complexity exceeded.
##    Consider downsampling or decimating your data.
##
## David Smith December 2011.

from pylab import *
import numpy as np

nPts=600100
x = np.random.rand(nPts)
y = np.random.rand(nPts)

## This seems to always succeed if Npts = 2, but fails
## for Npts  3.  For points between, it sometimes succeeds
## and sometimes fails.
figure(1)
plot (x, y)

## Chunking the plot alway succeeds.
figure(2)
chunk_size=2
iStarts=range(x.size/chunk_size)
for iStart in iStarts:
    print Plotting chunk starting at %d\n % iStart
    plot(x[iStart:iStart+chunk_size], y[iStart:iStart+chunk_size], '-b')

left_overs = nPts % chunk_size
if left_overs  0:
    print Leftovers %d points\n % left_overs
    plot(x[-left_overs-1:], y[-left_overs-1:], '-r')

print done plotting?
show()
-- end code 
Please don't reply to this post It is rediculous to plot 1 million points on
screen.  I am routinely capturing million-point traces from oscilloscopes and
other test equipment and to I need to be able to spot features in the
data (glitches if you will) that may not show up plotting decimated data.
I can then zoom the plot to inspect these features.

--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] missing data in plot

2011-12-06 Thread David Belohrad

Dear All,
I'm using matplotlib to generate graph from measured data in one of our
accelerators. The issue I have, that the data vector is huge. We talk,
say about 5 points to be displayed in a single graph, and I have to
assure, that those points are really there. Otherwise the image will be
broken.

Now, I did a plot like this one:

http://svnweb.cern.ch/world/wsvn/fimdab/trunk/doc/broken_acquisitions/broken_picture.pdf

The top-picture is somehow still correct, however bottom picture, which
should display data on the sample x-axis places as top one, is evidently
broken. The problem was traced somewhere into matplotlib, because the
original data used to construct the graph are fine.

Moreover, if I plot the same data, but just require different x-axis
setting to 'zoom' on a part, e.g. 350-600 of the original image linked
above, I get correct data output:

http://svnweb.cern.ch/world/wsvn/fimdab/trunk/doc/broken_acquisitions/correct_picture.pdf

This leads me to a conclusion, that matplotlib somehow 'chooses' the
data to be displayed.

How can I force it to display all the data? I do not mind if not all the
data are displayed in the graph, but it seems that it does not bother to
skip as well the peaks, which are of utmost importance...

any help appreciated. 

The source code to display the graphs is shown in function
writePdfBSlots in following code:

http://svnweb.cern.ch/world/wsvn/fimdab/trunk/SW/Python/captTest.py


thanks for any help

david

--
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [ploting data] Live data

2011-12-05 Thread David Hoese
If I'm understanding your question correctly and reading your code correctly, 
you're asking why the timer method of doing things works, but the principal() 
while loop method does not.

I had a couple solutions that involved the main event loop, but I just noticed 
2 main things that are probably wrong with your code:
1. You are calling 'principal' from inside __init__ so you never actually 
return from __init__ which means that you never call window.show() and 
therefore never call qApp.exec_().  If you really want to use the 'principal' 
method you would have to connect it to a one shot timer anyway to have it run 
after you have started the application ('qApp.exec_()').  I think the 
recommended way would be to use the timer the way you did in your latest email.

2. At least in the way my email client reads your original code, your calls to 
the matplotlib drawing functions aren't inside the while loop and the while 
loop never ends...although this doesn't matter if you don't fix #1 above.

Hope that made sense.

-Dave


On 12/5/11 1:44 PM, matplotlib-users-requ...@lists.sourceforge.net wrote:
 Message: 3
 Date: Mon, 5 Dec 2011 15:46:02 +0100
 From: Fabien Lafontlafont.fab...@gmail.com
 Subject: Re: [Matplotlib-users] [ploting data] Live data
 Cc:matplotlib-users@lists.sourceforge.net
 Message-ID:
   CAC9H_cjrgQBE6e6+jzZHyfYHonTeAg0XwU7c_2G-hu=s+z7...@mail.gmail.com
 Content-Type: text/plain; charset=ISO-8859-1

 Thx all for your remarks,

 I can't understand why this code works (when I use the timer method):


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [ploting data] Live data

2011-12-04 Thread David Hoese
I think you forget to set the layout on your central widget.

self.main_widget.setLayout(vbl) # in your case

-Dave

On 12/4/2011 9:57 AM, matplotlib-users-requ...@lists.sourceforge.net wrote:
 2011/12/2 Daniel Hyamsdhy...@gmail.com:
   I don't have PyQt installed, so I couldn't test the code, but don't you 
  want
   to be using extend and not append, if you are returning a list from 
  your
   two get_info() functions?
 
   On Fri, Dec 2, 2011 at 8:13 AM, Fabien Lafontlafont.fab...@gmail.com
   wrote:
 
   Hello everyone, I'm trying to plot live data extracting from remote
   devices (here it's simulated by get_info1 and 2 the result is always
   0.8 or 0.9
 
   I can't understand why it doesnt plot the graph at the end of the
   while loop. Does somebody has an idea?

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib.tests sub-modules missing

2011-11-15 Thread David Welch
/include/freetype2 -isysroot 
/Developer/SDKs/MacOSX10.6.sdk -pipe -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API 
-DPYCXX_ISO_CPP_LIB=1 -I. 
-I/tmp/virtualenv/matplotlibtest/lib/python2.6/site-packages/numpy/core/include 
-I. 
-I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c 
src/_png.cpp -o build/temp.macosx-10.6-universal-2.6/src/_png.o
cc1plus: warning: command line option -Wstrict-prototypes is valid for 
C/ObjC but not for C++
cc1plus: warning: command line option -Wstrict-prototypes is valid for 
C/ObjC but not for C++
g++-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wall -undefined 
dynamic_lookup -bundle -arch i386 -arch x86_64 -L/usr/X11/lib 
-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 
-I/usr/X11/include -I/usr/X11/include/freetype2 -isysroot 
/Developer/SDKs/MacOSX10.6.sdk build/temp.macosx-10.6-universal-2.6/src/_png.o 
build/temp.macosx-10.6-universal-2.6/src/mplutils.o 
build/temp.macosx-10.6-universal-2.6/CXX/cxx_extensions.o 
build/temp.macosx-10.6-universal-2.6/CXX/cxxsupport.o 
build/temp.macosx-10.6-universal-2.6/CXX/IndirectPythonInterface.o 
build/temp.macosx-10.6-universal-2.6/CXX/cxxextensions.o -lpng -lz -lstdc++ -lm 
-o build/lib.macosx-10.6-universal-2.6/matplotlib/_png.so
building 'matplotlib.backends._macosx' extension
gcc-4.2 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -arch i386 -arch 
x86_64 -I/usr/X11/include -I/usr/X11/include/freetype2 -isysroot 
/Developer/SDKs/MacOSX10.6.sdk -pipe -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API 
-DPYCXX_ISO_CPP_LIB=1 
-I/tmp/virtualenv/matplotlibtest/lib/python2.6/site-packages/numpy/core/include 
-I. 
-I/tmp/virtualenv/matplotlibtest/lib/python2.6/site-packages/numpy/core/include 
-Isrc -Iagg24/include -I. 
-I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c 
src/_macosx.m -o build/temp.macosx-10.6-universal-2.6/src/_macosx.o
src/_macosx.m: In function ‘FigureManager_init’:
src/_macosx.m:3363: warning: class 'View' does not implement the 
'NSWindowDelegate' protocol
src/_macosx.m: In function ‘FigureManager_init’:
src/_macosx.m:3363: warning: class 'View' does not implement the 
'NSWindowDelegate' protocol
g++-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wall -undefined 
dynamic_lookup -bundle -arch i386 -arch x86_64 -L/usr/X11/lib 
-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 
-I/usr/X11/include -I/usr/X11/include/freetype2 -isysroot 
/Developer/SDKs/MacOSX10.6.sdk 
build/temp.macosx-10.6-universal-2.6/src/_macosx.o 
build/temp.macosx-10.6-universal-2.6/CXX/cxx_extensions.o 
build/temp.macosx-10.6-universal-2.6/CXX/cxxextensions.o 
build/temp.macosx-10.6-universal-2.6/CXX/cxxsupport.o 
build/temp.macosx-10.6-universal-2.6/CXX/IndirectPythonInterface.o 
build/temp.macosx-10.6-universal-2.6/src/agg_py_transforms.o 
build/temp.macosx-10.6-universal-2.6/src/path_cleanup.o -lstdc++ -lm -o 
build/lib.macosx-10.6-universal-2.6/matplotlib/backends/_macosx.so -framework 
Cocoa
warning: no files found matching 'MANIFEST'
warning: no files found matching 'examples/data/*'
warning: no files found matching 'lib/mpl_toolkits'
Successfully installed matplotlib
Cleaning up...


Cheers,
Dave

--
David Welch
david.m.we...@gmail.com



On 11Nov, 2011, at 3:01 PM, Michael Droettboom wrote:

 Have you tried removing the build directory and install directories to 
 force a full rebuild?  It sounds like the build or install got stuck at 
 some point.  I've never seen it not copy *.py files in a package before.
 
 Mike
 
 On 11/11/2011 03:12 PM, David Welch wrote:
 Update: test folders are in the build directory, they are just not
 being copied during build.
 
 *bump*
 
 On 11/10/11, David Welchdavid.m.we...@gmail.com  wrote:
 Hello,
 
 I am installing matplotlib on Snow Leopard 10.6.  I downloaded v1.1.0 from
 the sourceforge site and installed in this manner:
 
 
 
 $ export CFLAGS=-arch i386 -arch x86_64 -I/usr/X11/include
 -I/usr/X11/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk
 $ export LDFLAGS=-Wall -undefined dynamic_lookup -bundle -arch i386 -arch
 x86_64 -L/usr/X11/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk
 $ export FFLAGS=-arch i386 -arch x86_64
 $ tar -xf matplotlib-1.1.0.tar.gz
 $ cd matplotlib-1.1.0
 $ python setup.py build
 $ python setup.py install
 $
 $ python
 import matplotlib as mpl
 mpl.test(1)
 ...EEE
 ==
 ERROR: Failure: AttributeError ('module' object has no attribute
 'test_backend_svg')
 --
 Traceback (most recent call last):
   File /private/tmp/test/lib/python2.6/site-packages/nose/loader.py, line
 379, in loadTestsFromName
 module = resolve_name(addr.module)
   File /private/tmp/test/lib/python2.6/site-packages/nose/util.py, line
 331, in resolve_name
 obj = getattr(obj, part

Re: [Matplotlib-users] Matplotlib.tests sub-modules missing

2011-11-14 Thread David Welch
Has ANYONE installed matplotlib on OSX 10.6 and had the module tests pass?  
Specifically in a virtualenv setup?

-Dave

--
David Welch
david.m.we...@gmail.com



On 11Nov, 2011, at 2:12 PM, David Welch wrote:

 Update: test folders are in the build directory, they are just not
 being copied during build.
 
 *bump*
 
 On 11/10/11, David Welch david.m.we...@gmail.com wrote:
 Hello,
 
 I am installing matplotlib on Snow Leopard 10.6.  I downloaded v1.1.0 from
 the sourceforge site and installed in this manner:
 
 
 
 $ export CFLAGS=-arch i386 -arch x86_64 -I/usr/X11/include
 -I/usr/X11/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk
 $ export LDFLAGS=-Wall -undefined dynamic_lookup -bundle -arch i386 -arch
 x86_64 -L/usr/X11/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk
 $ export FFLAGS=-arch i386 -arch x86_64
 $ tar -xf matplotlib-1.1.0.tar.gz
 $ cd matplotlib-1.1.0
 $ python setup.py build
 $ python setup.py install
 $
 $ python
 import matplotlib as mpl
 mpl.test(1)
 ...EEE
 ==
 ERROR: Failure: AttributeError ('module' object has no attribute
 'test_backend_svg')
 --
 Traceback (most recent call last):
  File /private/tmp/test/lib/python2.6/site-packages/nose/loader.py, line
 379, in loadTestsFromName
module = resolve_name(addr.module)
  File /private/tmp/test/lib/python2.6/site-packages/nose/util.py, line
 331, in resolve_name
obj = getattr(obj, part)
 AttributeError: 'module' object has no attribute 'test_backend_svg'
 
 (etc.)
 #
 
 The failure is for all modules in matplotlib.tests except for test_agg,
 test_cbook, test_mlab, and test_transform.
 
 Is the sourceforge achive incomplete?
 
 -Dave
 
 --
 David Welch
 david.m.we...@gmail.com
 
 
 
 
 
 
 -- 
 
 Dept. of Psychiatry
 Dept. of Biomedical Engineering
 University of Iowa


--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib.tests sub-modules missing

2011-11-11 Thread David Welch
Update: test folders are in the build directory, they are just not
being copied during build.

*bump*

On 11/10/11, David Welch david.m.we...@gmail.com wrote:
 Hello,

 I am installing matplotlib on Snow Leopard 10.6.  I downloaded v1.1.0 from
 the sourceforge site and installed in this manner:

 

 $ export CFLAGS=-arch i386 -arch x86_64 -I/usr/X11/include
 -I/usr/X11/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk
 $ export LDFLAGS=-Wall -undefined dynamic_lookup -bundle -arch i386 -arch
 x86_64 -L/usr/X11/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk
 $ export FFLAGS=-arch i386 -arch x86_64
 $ tar -xf matplotlib-1.1.0.tar.gz
 $ cd matplotlib-1.1.0
 $ python setup.py build
 $ python setup.py install
 $
 $ python
 import matplotlib as mpl
 mpl.test(1)
 ...EEE
 ==
 ERROR: Failure: AttributeError ('module' object has no attribute
 'test_backend_svg')
 --
 Traceback (most recent call last):
   File /private/tmp/test/lib/python2.6/site-packages/nose/loader.py, line
 379, in loadTestsFromName
 module = resolve_name(addr.module)
   File /private/tmp/test/lib/python2.6/site-packages/nose/util.py, line
 331, in resolve_name
 obj = getattr(obj, part)
 AttributeError: 'module' object has no attribute 'test_backend_svg'

 (etc.)
 #

 The failure is for all modules in matplotlib.tests except for test_agg,
 test_cbook, test_mlab, and test_transform.

 Is the sourceforge achive incomplete?

 -Dave

 --
 David Welch
 david.m.we...@gmail.com






-- 

Dept. of Psychiatry
Dept. of Biomedical Engineering
University of Iowa

--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matplotlib.tests sub-modules missing

2011-11-10 Thread David Welch
Hello, 

I am installing matplotlib on Snow Leopard 10.6.  I downloaded v1.1.0 from the 
sourceforge site and installed in this manner:



$ export CFLAGS=-arch i386 -arch x86_64 -I/usr/X11/include 
-I/usr/X11/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk
$ export LDFLAGS=-Wall -undefined dynamic_lookup -bundle -arch i386 -arch 
x86_64 -L/usr/X11/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk
$ export FFLAGS=-arch i386 -arch x86_64
$ tar -xf matplotlib-1.1.0.tar.gz
$ cd matplotlib-1.1.0
$ python setup.py build
$ python setup.py install
$
$ python
 import matplotlib as mpl
 mpl.test(1)
...EEE
==
ERROR: Failure: AttributeError ('module' object has no attribute 
'test_backend_svg')
--
Traceback (most recent call last):
  File /private/tmp/test/lib/python2.6/site-packages/nose/loader.py, line 
379, in loadTestsFromName
module = resolve_name(addr.module)
  File /private/tmp/test/lib/python2.6/site-packages/nose/util.py, line 331, 
in resolve_name
obj = getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_backend_svg'

(etc.)
#

The failure is for all modules in matplotlib.tests except for test_agg, 
test_cbook, test_mlab, and test_transform.

Is the sourceforge achive incomplete?

-Dave

--
David Welch
david.m.we...@gmail.com




--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how would you do this (animated bargraph) (Neal Becker)

2011-09-30 Thread David Hoese
Neal,

I do something similar to this where data that I'm plotting in a 2D line 
plot comes from a UDP socket and some memory mapped files.  To 
accomplish the live updating I have a mix of your #2 and #3.  I have a 
main GUI thread that displays the plots, then I have a second thread 
that gets data from a python generator and signals the GUI thread when 
that new data has arrived.  Inside the generator is where I have socket 
communications and select calls.  Hope this helps.

-Dave

On 9/30/11 9:10 AM, matplotlib-users-requ...@lists.sourceforge.net wrote:
 Message: 4
 Date: Fri, 30 Sep 2011 07:37:49 -0400
 From: Neal Beckerndbeck...@gmail.com
 Subject: [Matplotlib-users] how would you do this (animated bargraph)
 To:matplotlib-users@lists.sourceforge.net
 Message-ID:j649me$ug4$1...@dough.gmane.org
 Content-Type: text/plain; charset=ISO-8859-1

 I just put together an animated bargraph to show results from a realtime
 process.

 I used this as an example:
 http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4.html

 The tricky part for me was that in the original design, there was a realtime
 process running.  I have to write some information to my hardware (at a rate 
 of
 about 1/360ms).  To do this, I have a kernel driver that uses 'read' to tell 
 the
 user space when an interrupt has occurred, which is when the user space should
 write new information to the hardware.

 So I don't know how or if this could be hooked into qt event processing.  Just
 for a quick-and-dirty demo, I just removed the realtime processing from the
 user-space and put it in the kernel driver, so now my bargraph display can
 simply update on a periodic timer, and the userspace code has no realtime
 requirement.  But this is just a kludge.

 So I wonder how other's would solve this?  I'm thinking it would be either:

 1) multi-process
 2) multi-thread
 3) 1 process, but somehow hook my realtime events into qt's event loop.

 For #3, my device driver has a filedescriptor, that could use select to detect
 the interrupt (rather than blocking read call).

 #1 and #2 seem complicated.

--
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] OS X 10.6.8 macports python2.6 64bit , Installing matplotlib fails.

2011-08-16 Thread David Just
I eventually got it to mostly work using:
³sudo port install py26-matplotlib @1.0.1 +gtk2²

It doesn't match the correct egg format it seems, but it does work.


On 8/10/11 11:01 AM, David Just just.da...@mayo.edu wrote:

 Hello,
 
 I¹ve been trying to install matplotlib correctly for the past couple of days.
 
 I¹m using a macports python2.6 built with +universal on.
 
 If I install with the the downloadable .egg file I end up with a message that
 states that _path.so has problems. (built for 32bit I guess)
 ImportError: 
 dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2
 .6/site-packages/matplotlib-1.0.1_r0-py2.6.egg/matplotlib/_path.so, 2): no
 suitable image found.  Did find:
 
 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site
 -packages/matplotlib-1.0.1_r0-py2.6.egg/matplotlib/_path.so: no matching
 architecture in universal wrapper
 
 
 If I install with easy_install-2.6 matplotlib  from source I get the
 following:
 
 Best match: matplotlib 0.91.1
 
 src/_image.cpp:952: error: Œpng_infopp_NULL¹ was not declared in this
 scope
 error: Setup script exited with error: command '/usr/bin/gcc-4.2' failed
 with exit status 1
 
 If I install with port install matplotlib it fails because the install in not
 the correct path structure in the site-packages folder.
 
 
 I¹ve tried searching the web and have found some indications that I need to
 install 32bit python 2.6  but cannot find how to do that, and all of my
 production machinese have 64bit python installed on them.
 
 
 Any help at this point would be appreciated.
 Thanks. 
 
 
 
 

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Best way to cycle through numpy images using scroll?

2011-08-16 Thread David Just
I have an array of images stored as an array of numpy arrays.   I need to be
able to efficiently scroll through that set of images.   My first attempt at
doing this goes something like this:

--init--

self.ax = pyplot.imshow(imgdta[0], interpolation='spline36',
cmap=cm.gray, picker=True)  # draw the plot @UndefinedVariable
pyplot.axes().set_axis_off()
self.fig = self.ax.get_figure()
self.canvas = FigureCanvasGTKAgg(self.fig)

--onscroll--
self.ax.set_array(imdta[n]) # 0  n  num_images
self.canvas.draw()


This method of changing the image data does not seem to be very preferment.
It takes ~.25 seconds to go from one image to the next.   Can anybody
suggest a faster way?  This also ends up in a canvas that¹s much larger than
I need, is there a better way to define my view area?


Thank you,
Dave. 

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] OS X 10.6.8 macports python2.6 64bit , Installing matplotlib fails.

2011-08-16 Thread David Just
Hello,

I¹ve been trying to install matplotlib correctly for the past couple of
days.

I¹m using a macports python2.6 built with +universal on.

If I install with the the downloadable .egg file I end up with a message
that states that _path.so has problems. (built for 32bit I guess)
ImportError: 
dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/pytho
n2.6/site-packages/matplotlib-1.0.1_r0-py2.6.egg/matplotlib/_path.so, 2): no
suitable image found.  Did find:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/si
te-packages/matplotlib-1.0.1_r0-py2.6.egg/matplotlib/_path.so: no matching
architecture in universal wrapper


If I install with easy_install-2.6 matplotlib  from source I get the
following:

Best match: matplotlib 0.91.1

src/_image.cpp:952: error: Œpng_infopp_NULL¹ was not declared in this
scope
error: Setup script exited with error: command '/usr/bin/gcc-4.2' failed
with exit status 1

If I install with port install matplotlib it fails because the install in
not the correct path structure in the site-packages folder.


I¹ve tried searching the web and have found some indications that I need to
install 32bit python 2.6  but cannot find how to do that, and all of my
production machinese have 64bit python installed on them.


Any help at this point would be appreciated.
Thanks. 





--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Forcing the size of a figure

2011-08-12 Thread David Just
Now that I¹m pre-building all my enlarged interpolated images to scroll
through,  I¹m having trouble forcing the figure/FigureCanvas to be the size
I want.

I¹m trying: 
fig.set_size_inches(768 / 72.0, 768 / 72.0),  but it ends up the same size
as the default plot.

Thanks,
Dave




--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Best way to cycle through numpy images

2011-08-11 Thread David Just
Sorry if this get¹s re-posted,  my earlier e-mail didn¹t seem to go through.

I have an array of images stored as an array of numpy arrays.   I need to be
able to efficiently scroll through that set of images.   My first attempt at
doing this goes something like this:

--init--

self.ax = pyplot.imshow(imgdta[0], interpolation='spline36',
cmap=cm.gray, picker=True)  # draw the plot @UndefinedVariable
pyplot.axes().set_axis_off()
self.fig = self.ax.get_figure()
self.canvas = FigureCanvasGTKAgg(self.fig)

--onscroll--
self.ax.set_array(imdta[n]) # 0  n  num_images
self.canvas.draw()


This method ends up re-interpolating the image on each scroll event (which
takes SIGNIFICANT time).   What I¹d like to do is pre-build the images and
then just change what image is displayed on the canvas on each scroll event.
I cannot seem to figure out how to do this.  Can anybody give me a pointer
in the right direction.

Thanks,
Dave.
--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


  1   2   3   4   5   >