Re: [Matplotlib-users] ValueError

2010-07-09 Thread Matthias Michler
On Friday July 9 2010 00:06:05 Shir J. Livne wrote:
 Hello,
 
 I keep getting the error ValueError: Need more than 1 value to unpack
 every time I try to use the line ax.plot_wireframe(myArray[:,0],
 myArray[:,1], myArray[:,2])
 
 What does that error mean?

Hi Shir,

I think you used 1d-arrays for myArray[:, i] and the plot_wireframe method 
expects 2d-arrays for x, y and z, respectively. Inside the plot_wireframe 
method the shape of Z is transformed into number of rows and columns:
rows, cols = Z.shape
and that is the point where you get the ValueError, because Z.shape is only 
one element.

You may also want to look at the examples: 
http://matplotlib.sourceforge.net/examples/mplot3d/wire3d_animation_demo.html
http://matplotlib.sourceforge.net/examples/mplot3d/wire3d_demo.html

If this doesn't help, it would be useful if you would set up a small stand-
alone example illustrating your problem with some simple data with the shape 
of myArray.

Kind regards,
Matthias

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread Matthias Michler
On Friday July 9 2010 06:02:58 per freem wrote:
 How can I plot the empirical CDF of an array of numbers in matplotlib
 in Python? I'm looking for the cdf analog of pylab's hist function.
 
 One thing I can think of is:
 
 from scipy.stats import cumfreq
 a = array([...]) # my array of numbers
 num_bins =  20
 b = cumfreq(a, num_bins)
 plt.plot(b)
 
 Is that correct though? Is there an easier/better way?

Hi,

I would use pyplot.hist to produce a histogram with a bar for each bin. By use 
of the keyword argument 'cumulative' you can select cumulative frequency 
distribution instead of density.

Kind regards,
Matthias

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem importing pyplot/pylab on mac os x 10.4.11

2010-07-09 Thread John Hunter
On Fri, Jul 9, 2010 at 7:25 AM, Karianne Holhjem
karia...@astro.uni-bonn.de wrote:

 Regarding numpy - what you say is intersting. I couldn't find any such
 problems in my google-searches. I am running version 1.2.1:
 [karianneholhjem:/] karianne% python -c 'import numpy; print 
 numpy.__version__'
 1.2.1

Can you try upgrading numpy to the latest released version?  This is
likely your problem.  I would rm -rf the old numpy in your
site-packages directory and upgrade to 1.4.1


https://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1-py2.5-python.org.dmg/download

Are you using python.org python or Apple python -- it appears the
installer above is for python.org python

JDH

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread Alan G Isaac
On 7/9/2010 12:02 AM, per freem wrote:
  How can I plot the empirical CDF of an array of numbers in matplotlib
  in Python?


I recalled David Huard posted the below,
which apparently was once in the sandbox...
hth,
Alan Isaac

def empiricalcdf(data, method='Hazen'):
 Return the empirical cdf.

 Methods available (here i goes from 1 to N)
 Hazen:   (i-0.5)/N
 Weibull: i/(N+1)
 Chegodayev:  (i-.3)/(N+.4)
 Cunnane: (i-.4)/(N+.2)
 Gringorten:  (i-.44)/(N+.12)
 California:  (i-1)/N

 :see:
http://svn.scipy.org/svn/scipy/trunk/scipy/sandbox/dhuard/stats.py
 :author: David Huard
 
 i = np.argsort(np.argsort(data)) + 1.
 nobs = len(data)
 method = method.lower()
 if method == 'hazen':
 cdf = (i-0.5)/nobs
 elif method == 'weibull':
 cdf = i/(nobs+1.)
 elif method == 'california':
 cdf = (i-1.)/nobs
 elif method == 'chegodayev':
 cdf = (i-.3)/(nobs+.4)
 elif method == 'cunnane':
 cdf = (i-.4)/(nobs+.2)
 elif method == 'gringorten':
 cdf = (i-.44)/(nobs+.12)
 else:
 raise 'Unknown method. Choose among Weibull, Hazen, Chegodayev,
Cunnane, Gringorten and California.'
 return cdf




--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] anumated plot with autscaling axises

2010-07-09 Thread aliko
Good day!
Could You please tell me how can I get axises autoscaling in the 
animated plot example. I've take an example and have modifyed it 
slightly so the second line in plot gets out of bounding box during 
animation. What I need is autoscaling of axises during animation. Please 
point mee what I have to do.

Thanks a lot!

Hereafter a modifyed example:


# For detailed comments on animation and the techniqes used here, see
# the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations

import sys

from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as 
FigureCanvas

from PyQt4 import QtGui

ITERS = 100

import numpy as np
import time

class BlitQT(FigureCanvas):
 def __init__(self):
 FigureCanvas.__init__(self, Figure())

 self.ax = self.figure.add_subplot(111)
 self.ax.grid()
 self.draw()

 self.old_size = self.ax.bbox.width, self.ax.bbox.height
 self.ax_background = self.copy_from_bbox(self.ax.bbox)
 self.cnt = 0

 self.x = np.arange(0,2*np.pi,0.01)
 self.sin_line, = self.ax.plot(self.x, np.sin(self.x), 
animated=True)
 self.cos_line, = self.ax.plot(self.x, np.cos(self.x), 
animated=True)
 self.draw()

 self.tstart = time.time()
 self.startTimer(10)

 def timerEvent(self, evt):
 current_size = self.ax.bbox.width, self.ax.bbox.height
 if self.old_size != current_size:
 self.old_size = current_size
 self.ax.clear()
 self.ax.grid()
 self.draw()
 self.ax_background = self.copy_from_bbox(self.ax.bbox)

 self.restore_region(self.ax_background, bbox=self.ax.bbox)

 # update the data
 self.sin_line.set_ydata(np.sin(self.x+self.cnt/10.0))
 self.cos_line.set_ydata((self.x+self.cnt)/50.0)
 # just draw the animated artist
 self.ax.draw_artist(self.sin_line)
 self.ax.draw_artist(self.cos_line)
 # just redraw the axes rectangle
 self.blit(self.ax.bbox)

 if self.cnt == 0:
 # TODO: this shouldn't be necessary, but if it is excluded the
 # canvas outside the axes is not initially painted.
 self.draw()
 if self.cnt==ITERS:
 # print the timing info and quit
 print 'FPS:' , ITERS/(time.time()-self.tstart)
 sys.exit()
 else:
 self.cnt += 1

app = QtGui.QApplication(sys.argv)
widget = BlitQT()
widget.show()

sys.exit(app.exec_())


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
I'd like to clarify: I want the empirical cdf, but I want it to be
normalized.  There's a normed=True option to plt.hist but how can I do
the equivalent for CDFs?

On Fri, Jul 9, 2010 at 9:14 AM, Alan G Isaac alan.is...@gmail.com wrote:
 On 7/9/2010 12:02 AM, per freem wrote:
  How can I plot the empirical CDF of an array of numbers in matplotlib
  in Python?


 I recalled David Huard posted the below,
 which apparently was once in the sandbox...
 hth,
 Alan Isaac

 def empiricalcdf(data, method='Hazen'):
     Return the empirical cdf.

     Methods available (here i goes from 1 to N)
         Hazen:       (i-0.5)/N
         Weibull:     i/(N+1)
         Chegodayev:  (i-.3)/(N+.4)
         Cunnane:     (i-.4)/(N+.2)
         Gringorten:  (i-.44)/(N+.12)
         California:  (i-1)/N

     :see:
 http://svn.scipy.org/svn/scipy/trunk/scipy/sandbox/dhuard/stats.py
     :author: David Huard
     
     i = np.argsort(np.argsort(data)) + 1.
     nobs = len(data)
     method = method.lower()
     if method == 'hazen':
         cdf = (i-0.5)/nobs
     elif method == 'weibull':
         cdf = i/(nobs+1.)
     elif method == 'california':
         cdf = (i-1.)/nobs
     elif method == 'chegodayev':
         cdf = (i-.3)/(nobs+.4)
     elif method == 'cunnane':
         cdf = (i-.4)/(nobs+.2)
     elif method == 'gringorten':
         cdf = (i-.44)/(nobs+.12)
     else:
         raise 'Unknown method. Choose among Weibull, Hazen, Chegodayev,
 Cunnane, Gringorten and California.'
     return cdf




 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread Robert Kern
On 7/9/10 10:02 AM, per freem wrote:
 I'd like to clarify: I want the empirical cdf, but I want it to be
 normalized.  There's a normed=True option to plt.hist but how can I do
 the equivalent for CDFs?

There is no such thing as a normalized empirical CDF. Or rather, there is no 
such thing as an unnormalized empirical CDF.

Alan's code is good. Unless if you have a truly staggering number of points, 
there is no reason to bin the data first.

-- 
Robert Kern

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


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
How does Alan's code compare with using cumfreq and then plotting its
result?  Is the only difference that cumfreq bins the data?

On Fri, Jul 9, 2010 at 10:12 AM, Robert Kern robert.k...@gmail.com wrote:
 On 7/9/10 10:02 AM, per freem wrote:
 I'd like to clarify: I want the empirical cdf, but I want it to be
 normalized.  There's a normed=True option to plt.hist but how can I do
 the equivalent for CDFs?

 There is no such thing as a normalized empirical CDF. Or rather, there is no
 such thing as an unnormalized empirical CDF.

 Alan's code is good. Unless if you have a truly staggering number of points,
 there is no reason to bin the data first.

 --
 Robert Kern

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


 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
Also, I am not sure how to use alan's code.

If I try:

ec = empirical_cdf(my_data)
plt.plot(ec)

it doesn't actually look like a cdf

On Fri, Jul 9, 2010 at 10:17 AM, per freem perfr...@gmail.com wrote:
 How does Alan's code compare with using cumfreq and then plotting its
 result?  Is the only difference that cumfreq bins the data?

 On Fri, Jul 9, 2010 at 10:12 AM, Robert Kern robert.k...@gmail.com wrote:
 On 7/9/10 10:02 AM, per freem wrote:
 I'd like to clarify: I want the empirical cdf, but I want it to be
 normalized.  There's a normed=True option to plt.hist but how can I do
 the equivalent for CDFs?

 There is no such thing as a normalized empirical CDF. Or rather, there is no
 such thing as an unnormalized empirical CDF.

 Alan's code is good. Unless if you have a truly staggering number of points,
 there is no reason to bin the data first.

 --
 Robert Kern

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


 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread Robert Kern
On 7/9/10 10:31 AM, per freem wrote:
 Also, I am not sure how to use alan's code.

 If I try:

 ec = empirical_cdf(my_data)
 plt.plot(ec)

 it doesn't actually look like a cdf

Make sure my_data is sorted first.

plt.plot(my_data, ec)

You probably want to use one of the steps linestyles; I'm not sure which one 
would be best. It probably doesn't matter much.

-- 
Robert Kern

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


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] update an existing contour plot with new data

2010-07-09 Thread Ryan May
On Fri, Jul 9, 2010 at 6:28 AM, Johannes Röhrs johanne...@met.no wrote:
 I have some troubles updating a contour plot. I reduced my code to a simple 
 example to reproduce the problem:

 [code]
 from pylab *
 import scipy as sp

 x=sp.arange(0,2*sp.pi,0.1)
 X,Y=sp.meshgrid(x,x)
 f1=sp.sin(X)+sp.sin(Y)
 f2=sp.cos(X)+sp.cos(Y)

 figure()
 C=contourf(f1)
 show()

 C.set_array(f2)
 draw()
 [\code]

 What do I need to do to update an existing contour plot with new data?

The set_array() method (I think) only impacts the colormapping
information for contourf, and even then doesn't appear to update.
What you need to do is make a new contour plot and remove the old one,
especially if you need to change the underlying contoured data. This
should be as easy as C.remove(), but for some reason, this doesn't
exist (I'll go add it in a minute).  So instead, you need to do the
following:

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0, 2 * np.pi, 0.1)
X,Y = np.meshgrid(x,x)
f1 = np.sin(X) + np.sin(Y)
f2 = np.cos(X) + np.cos(Y)

plt.figure()
C = plt.contourf(f1)
plt.show()
for coll in C.collections:
plt.gca().collections.remove(coll)
C = plt.contourf(f2)
plt.draw()

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] update an existing contour plot with new data

2010-07-09 Thread Johannes Röhrs


Thanks a lot, this solutions seems to serve my purpose. A new method C.remove() 
would of course be even better.

One could say the problem is solved, but why does there no method exist to 
update a contour plot as there is for many other plot routines, i.e.
set_xdata/set_ydata for plot
set_data for imshow or
set_UVC for quiver and so on.
set_array should be the corresponding method for contour plots, and if type 
C.get_array() I actually get the data array that I used to plot the countours!

My purpose of this is to animate the contour plot, and I did read somewhere 
that updating the plot is much faster/more efficient than deleting and 
recreating the plot.



- Original Message -
From: Ryan May rma...@gmail.com
To: Johannes Röhrs johanne...@met.no
Cc: matplotlib-users@lists.sourceforge.net
Sent: Friday, 9 July, 2010 5:11:37 PM
Subject: Re: [Matplotlib-users] update an existing contour plot with new data

On Fri, Jul 9, 2010 at 6:28 AM, Johannes Röhrs johanne...@met.no wrote:
 I have some troubles updating a contour plot. I reduced my code to a simple 
 example to reproduce the problem:

 [code]
 from pylab *
 import scipy as sp

 x=sp.arange(0,2*sp.pi,0.1)
 X,Y=sp.meshgrid(x,x)
 f1=sp.sin(X)+sp.sin(Y)
 f2=sp.cos(X)+sp.cos(Y)

 figure()
 C=contourf(f1)
 show()

 C.set_array(f2)
 draw()
 [\code]

 What do I need to do to update an existing contour plot with new data?

The set_array() method (I think) only impacts the colormapping
information for contourf, and even then doesn't appear to update.
What you need to do is make a new contour plot and remove the old one,
especially if you need to change the underlying contoured data. This
should be as easy as C.remove(), but for some reason, this doesn't
exist (I'll go add it in a minute).  So instead, you need to do the
following:

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0, 2 * np.pi, 0.1)
X,Y = np.meshgrid(x,x)
f1 = np.sin(X) + np.sin(Y)
f2 = np.cos(X) + np.cos(Y)

plt.figure()
C = plt.contourf(f1)
plt.show()
for coll in C.collections:
plt.gca().collections.remove(coll)
C = plt.contourf(f2)
plt.draw()

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] update an existing contour plot with new data

2010-07-09 Thread Ryan May
On Fri, Jul 9, 2010 at 10:49 AM, Johannes Röhrs johanne...@met.no wrote:


 Thanks a lot, this solutions seems to serve my purpose. A new method 
 C.remove() would of course be even better.

 One could say the problem is solved, but why does there no method exist to 
 update a contour plot as there is for many other plot routines, i.e.
 set_xdata/set_ydata for plot
 set_data for imshow or
 set_UVC for quiver and so on.
 set_array should be the corresponding method for contour plots, and if type 
 C.get_array() I actually get the data array that I used to plot the countours!

 My purpose of this is to animate the contour plot, and I did read somewhere 
 that updating the plot is much faster/more efficient than deleting and 
 recreating the plot.

This is the case when setting up the initial book-keeping is a
significant portion of the time to make the plot. In this case, most
of the work is in generating the contours, so I don't think you'd get
much savings. (Granted, I haven't tried to verify these assumptions.)

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Problems with pygtk and matplotlib

2010-07-09 Thread Preben Randhol
Hi

I'm trying to plot several subplots. I have setup a scrollwidget and
viewport and I pack a canvas into a vbox in the viewport.

Problem is that when I scroll, either some of the subplots are missing,
or I get an error when I try to zoom on a graph that argument is not a
gdk.gtk.image (or something like that) but None.

I thought this was fixed in 1.0, but it isn't

Please advice!

Thanks in advance.

Preben

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] No color scaling when using plot_surface. Please help

2010-07-09 Thread Jeremy Conlin
On Thu, Jul 8, 2010 at 8:41 AM, Jeremy Conlin jlcon...@gmail.com wrote:
 On Sun, Jul 4, 2010 at 8:38 PM, Benjamin Root ben.r...@ou.edu wrote:
 Jeremy,

 The pcolor function can take a vmin and a vmax parameter if you wish to
 control the colorscaling.  In addition, you can use a special array
 structure called a masked array to have pcolor ignore special values.
 Assuming your data is 'vals':

 vals_masked = numpy.ma.masked_array(vals, vals == 0.0)

 Note that depending on your situation, doing an equality with with a
 floating point  value probably isn't very reliable, so be sure to test and
 modify to suit your needs.  'vals_masked' can then be passed to pcolor
 instead of vals.

 Yes, I think this is exactly what I need.  Thanks!


To follow up with my response, I tried the above and it works nicely
with pyplot.pcolor.  I would like to get a 3D version of this, like I
get using Axes3D.plot_surface.  Is this just not implemented yet?  I
am using 0.99.1.1.  Has this been implemented in matplotlib 1.0?

Thanks,
Jeremy

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with pygtk and matplotlib

2010-07-09 Thread John Hunter
On Fri, Jul 9, 2010 at 3:10 PM, Preben Randhol rand...@pvv.org wrote:
 Hi

 I'm trying to plot several subplots. I have setup a scrollwidget and
 viewport and I pack a canvas into a vbox in the viewport.

 Problem is that when I scroll, either some of the subplots are missing,
 or I get an error when I try to zoom on a graph that argument is not a
 gdk.gtk.image (or something like that) but None.

 I thought this was fixed in 1.0, but it isn't

 Please advice!


Does this example work for you?

http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_gtk3.html

It uses a ScrolledWindow.

Also, are you using backend_gtk or backend_gtkagg (and does it matter
for your problem?)

If you could create a minimal example starting with
embedding_in_gtk3.py that replicates your problem, we're more likely
to be able to help.

JDH

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] No color scaling when using plot_surface. Please help

2010-07-09 Thread Benjamin Root
Jeremy,

I believe that 0.99.1 is fairly old.  I don't know when Axes3D came along,
but I am sure you can find it in 0.99.3.  It is most definitely in 1.0, but
you might not need to go that far if your distro does not provide it.

Ben Root

On Fri, Jul 9, 2010 at 4:50 PM, Jeremy Conlin jlcon...@gmail.com wrote:

 On Thu, Jul 8, 2010 at 8:41 AM, Jeremy Conlin jlcon...@gmail.com wrote:
  On Sun, Jul 4, 2010 at 8:38 PM, Benjamin Root ben.r...@ou.edu wrote:
  Jeremy,
 
  The pcolor function can take a vmin and a vmax parameter if you wish to
  control the colorscaling.  In addition, you can use a special array
  structure called a masked array to have pcolor ignore special
 values.
  Assuming your data is 'vals':
 
  vals_masked = numpy.ma.masked_array(vals, vals == 0.0)
 
  Note that depending on your situation, doing an equality with with a
  floating point  value probably isn't very reliable, so be sure to test
 and
  modify to suit your needs.  'vals_masked' can then be passed to pcolor
  instead of vals.
 
  Yes, I think this is exactly what I need.  Thanks!
 

 To follow up with my response, I tried the above and it works nicely
 with pyplot.pcolor.  I would like to get a 3D version of this, like I
 get using Axes3D.plot_surface.  Is this just not implemented yet?  I
 am using 0.99.1.1.  Has this been implemented in matplotlib 1.0?

 Thanks,
 Jeremy

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] interactive plots in ipython -pylab are delayed until ipython prompt

2010-07-09 Thread bdb112

I have successfully used ipython -pylab under w32 python, but under the
builtin ipython under ubuntu 9 and 10, the graphics display thread seems to
block until the ipython command line - as if the threading (internal to
ipython etc) is not happening.

For example if the following is pasted in, the plot appears after 2 seconds,
instead of straight away, as it used to in w32 python 2.6, (and I think, but
am not sure, in earlier linux pythons).  The reason I want this feature is
to show intermediate
results of long computations, without blocking, as would happen in straight
python or ipython. See version numbers at end.



import time
# Note - this version is meant to be pasted!

print('When pasted in to ipython -pylab, the plot should appear immediately,
'
  ' then the ipython prompt after sleep(2): but the plot waits until the
prompt!')
plot([3,4], hold=0)
ion()
show()
time.sleep(2)

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
IPython 0.10
matplotlib.__version__   Out[3]: '0.99.1.1'


-- 
View this message in context: 
http://old.nabble.com/interactive-plots-in-ipython--pylab-are-delayed-until-ipython-prompt-tp29123816p29123816.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] interactive plots in ipython -pylab are delayed until ipython prompt

2010-07-09 Thread John Hunter
On Fri, Jul 9, 2010 at 9:52 PM, bdb112 boyd.blackw...@anu.edu.au wrote:

 python or ipython. See version numbers at end.



 import time
 # Note - this version is meant to be pasted!

 print('When pasted in to ipython -pylab, the plot should appear immediately,
 '
      ' then the ipython prompt after sleep(2): but the plot waits until the
 prompt!')
 plot([3,4], hold=0)
 ion()
 show()
 time.sleep(2)

 Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
 IPython 0.10
 matplotlib.__version__   Out[3]: '0.99.1.1

Any chance you can test this with the latest release 1.0.0?

JDH

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users