[Matplotlib-users] GUI setSizePolicy
Hi, I put these lines FigureCanvas.setSizePolicy(self,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) in the following code, but I have not idea what they do as the GUI seems to behave equivalently (I can resize easily with the mouse) if they are removed. Any thoughts? D. import sys from PyQt4 import QtGui import numpy as np from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar class Qt4MplCanvas(FigureCanvas): def __init__(self): self.fig = Figure() self.axes = self.fig.add_subplot(111) t = np.arange(0.0, 3.0, 0.01) s = np.cos(2 * np.pi * t) self.axes.plot(t, s) FigureCanvas.__init__(self, self.fig) FigureCanvas.setSizePolicy(self,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) qApp = QtGui.QApplication(sys.argv) fc = Qt4MplCanvas() fc.show() sys.exit(qApp.exec_())-- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Finding the Supposed MPL show() "bug".
I chronicled some of my MPL problems here. It appeared that show() could be the problem. The problem is apparently the difference between running the program in IDLE and executing it from the folder (Maybe there's a name for that?). There are only about 8 lines of MPL code to the show() in a def. I inserted and moved a return down each line, executing the program afterwords. It behaved as expected, no plot. Once I removed the plot, I got the unexpected behavior. A video clip not played. So off to a direct py file execution. It worked fully. What this amounts to is that we need to find a better way for users to execute the program than through IDLE. Tomorrow I'll pass this by the original developer. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Finding the Supposed MPL show() "bug".
Foiled again. I clicked on the previous version, which has no MPL code in the same def. The show() is where things go wrong though. The question now is where did the program go after the show()? Maybe it's time to put the interactive debugger into play, which I've barely used. I have used others. On 2/10/2010 6:44 PM, Wayne Watson wrote: > I chronicled some of my MPL problems here. It appeared that show() > could be the problem. The problem is apparently the difference between > running the program in IDLE and executing it from the folder (Maybe > there's a name for that?). There are only about 8 lines of MPL code to > the show() in a def. I inserted and moved a return down each line, > executing the program afterwords. It behaved as expected, no plot. > Once I removed the plot, I got the unexpected behavior. A video clip > not played. So off to a direct py file execution. It worked fully. > > What this amounts to is that we need to find a better way for users to > execute the program than through IDLE. Tomorrow I'll pass this by the > original developer. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] logarithmic plotting and the grid
grid takes an optional argument "which". Unfortunately this is not properly documented with pylab.grid and Axes.grid. But see http://matplotlib.sourceforge.net/api/axis_api.html?highlight=grid#matplotlib.axis.Axis.grid grid(True) # this turns on gridlines for major ticks grid(True, which="minor") # this turns on gridlines for minor ticks. -JJ On Wed, Feb 10, 2010 at 6:18 PM, K L wrote: > Hi, > > I want a more "detailed" grid for my logarithmic plotting. The following code: > > from pylab import * > semilogy(range(10)) > grid(True) > show() > > will produce output like this: http://i49.tinypic.com/2dpd3r.png > > Notice that the grid uniformly slices the image. And some ticks on the > y-axis doesn't have grid lines. This is not want I want. > > Conversely, something like this is preferred: > > http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/bert_mat_explot1.gif > > Thanks! > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] logarithmic plotting and the grid
Whoop, the "evil' mathwork even doesn't allow me to refer to a picture on the site. ok, here's the effect I need (semilogy plotting with more detailed grid) http://i47.tinypic.com/95zihi.gif Sorry for any inconvenience! -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] logarithmic plotting and the grid
Hi, I want a more "detailed" grid for my logarithmic plotting. The following code: from pylab import * semilogy(range(10)) grid(True) show() will produce output like this: http://i49.tinypic.com/2dpd3r.png Notice that the grid uniformly slices the image. And some ticks on the y-axis doesn't have grid lines. This is not want I want. Conversely, something like this is preferred: http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/bert_mat_explot1.gif Thanks! -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Does Matplotlib have Image Processing?
Wayne Watson wrote: > See Subject. not really. Try: http://www.scipy.org/doc/api_docs/SciPy.ndimage.html for that. I think there are other IP libs wrapped for python use, too. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] blit animation with patches
On Wed, Feb 10, 2010 at 12:39 PM, John Jameson wrote: > Hi - > I am wondering how to animate using blit and patches. > The code below was modified from one of the examples. > You will see that it shows (and moves) the rectangle just fine, but > the circle never shows up. Artists must be added to the axes -- when you do line, = ax.plot(...) the Line2D object is added t the Axes. But you never add the circle to the axes. So do cir = CirclePolygon((x_cir, 1), 0.3, animated=True, resolution=6, lw=2) ax.add_patch(cir) and then call ax.draw_artist(cir) when you want to draw it. JDH > best, > Jaron > > > > import gtk, gobject > import matplotlib > matplotlib.use('GTKAgg') #Agg rendering to a GTK canvas (requires PyGTK) > import numpy as np > import matplotlib.pyplot as plt > from pylab import * > from matplotlib.patches import CirclePolygon > > fig = plt.figure(figsize=(14,10)) > ax = fig.add_subplot(111, autoscale_on=False ) > canvas = fig.canvas > > x_start = array([1.0, 2, 2, 1, 1]) > y_start = array([1.0, 1, 2, 2, 1]) > > plt.axis([-1, 7, -0.5, 2.2]) > > def update_line(): > global x, y > print update_line.cnt > if update_line.background is None: > update_line.background = canvas.copy_from_bbox(ax.bbox) > canvas.restore_region(update_line.background) > > x = x_start + 0.012 * update_line.cnt > y = y_start + 0.0001 * update_line.cnt > line, = ax.plot(x, y, animated=True, lw=2) > ax.draw_artist(line) > > x_cir = 1.0 + 0.001*update_line.cnt > cir = CirclePolygon((x_cir, 1), 0.3, animated=True, resolution=6, lw=2 > ) > ax.draw_artist(cir) > > canvas.blit(ax.bbox) > > if update_line.cnt == 1: > gtk.mainquit() > raise SystemExit > update_line.cnt += 1 > return True > > update_line.cnt = 0 > update_line.background = None > > def start_anim(event): > gobject.idle_add(update_line) > canvas.mpl_disconnect(start_anim.cid) > > start_anim.cid = canvas.mpl_connect('draw_event', start_anim) > > plt.show() > > > > > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] blit animation with patches
Hi - I am wondering how to animate using blit and patches. The code below was modified from one of the examples. You will see that it shows (and moves) the rectangle just fine, but the circle never shows up. best, Jaron import gtk, gobject import matplotlib matplotlib.use('GTKAgg') #Agg rendering to a GTK canvas (requires PyGTK) import numpy as np import matplotlib.pyplot as plt from pylab import * from matplotlib.patches import CirclePolygon fig = plt.figure(figsize=(14,10)) ax = fig.add_subplot(111, autoscale_on=False ) canvas = fig.canvas x_start = array([1.0, 2, 2, 1, 1]) y_start = array([1.0, 1, 2, 2, 1]) plt.axis([-1, 7, -0.5, 2.2]) def update_line(): global x, y print update_line.cnt if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) canvas.restore_region(update_line.background) x = x_start + 0.012 * update_line.cnt y = y_start + 0.0001 * update_line.cnt line, = ax.plot(x, y, animated=True, lw=2) ax.draw_artist(line) x_cir = 1.0 + 0.001*update_line.cnt cir = CirclePolygon((x_cir, 1), 0.3, animated=True, resolution=6, lw=2 ) ax.draw_artist(cir) canvas.blit(ax.bbox) if update_line.cnt == 1: gtk.mainquit() raise SystemExit update_line.cnt += 1 return True update_line.cnt = 0 update_line.background = None def start_anim(event): gobject.idle_add(update_line) canvas.mpl_disconnect(start_anim.cid) start_anim.cid = canvas.mpl_connect('draw_event', start_anim) plt.show() -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Sankey diagram
On Wed, Feb 10, 2010 at 12:44 PM, Ben Axelrod wrote: > Really cool plot. > > Speaking of the 1.0 release, is there a target date set? And if there is > going to be another bug-fix release before 1.0, is there a target date for > that? No target date yet, it has been on my wish list for a while. I need to get my OSX build environment going again after my powerbook died, and then we need to work through the bugs on the sf site. Once I get the first part done, I can quickly do a bugfix release on the 99 branch, and then turn my attention to closing bugs on the HEAD. Actively recruiting OSX release managers, so if someone wants to take a crack at it see if you can build the binaries from svn HEAD using release/osx/Makefile (and see README in same directory) JDH -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Does Matplotlib have Image Processing?
See Subject. I see some fairly minimal IP in a image tutorial. I'm thinkig of things like a dark subtract. -- "Crime is way down. War is declining. And that's far from the good news." -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Sankey diagram
Really cool plot. Speaking of the 1.0 release, is there a target date set? And if there is going to be another bug-fix release before 1.0, is there a target date for that? Thanks, -Ben -Original Message- From: John Hunter [mailto:jdh2...@gmail.com] Sent: Wednesday, February 10, 2010 10:55 AM To: Yannick Copin Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Sankey diagram 2010/2/9 Yannick Copin : > Hi List, > > I made a script to draw very simple (single-direction single-input > single-sided single-everything) Sankey diagrams (attached). I think I > could share, if it can be of any use... Great -- I had never heard of a Sankey diagram but just took a look on wikipedia. Very nice -- I contributed this to examples/api and it will show up on the web site and gallery after the mpl 1.0 release. Thanks for sending it! JDH -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting multiline graph with large dataset (6 lines, about 30, 000, 000 points total
On 2/10/2010 1:17 PM, Oz Nahum wrote: > This is really crazy ploting so many data point, after all the human > eye can't separate all the data. Following up on Oz's point ... let's suppose that is 5M points for each of the 6 lines, and that you will try to place them on a 5 inch wide axis. That is 1M plotted points per horizontal inch. Here is a list of typical monitor pixel densities: http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density Alan Isaac -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] LateX Legend (again)
Ah, I didn't know there was a section of the rc file for legends. Adding mpl.rcParams['font.family'] = 'serif' mpl.rcParams['legend.fontsize'] = 'medium' fixed things right up. Thanks, Jeff On Feb 10, 2010, at 1:01 PM, wrote: > Jeff, > > I send all of my figures through LaTeX and don't have this problem. > The only thing I can think of is to check your matplotlibrc file > and make sure you've set the legend font to be the same size as the > other fonts. > > HTH, > -paul h. > >> -Original Message- >> From: Jeffrey Blackburne [mailto:je...@mit.edu] >> Sent: Wednesday, February 10, 2010 9:45 AM >> To: matplotlib-users@lists.sourceforge.net >> Subject: [Matplotlib-users] LateX Legend (again) >> >> Hi everyone, >> >> This has been brought up before, but not completely addressed. Is it >> possible to get the text in a Legend to match the rest of the text >> when using LateX? Here is an example of the problem: >> >> import matplotlib as mpl >> mpl.rcParams['text.usetex'] = True >> import matplotlib.pyplot as plt >> >> fig = plt.figure() >> ax = fig.add_subplot(111) >> ax.plot([1,5,2,3]) # random data >> plt.figlegend(ax.lines,[r'$\rm{label}$ label'],loc='upper left') >> plt.show() >> >> The first word is at least in a roman font, but the font size is >> wrong. I am using svn revision 8005 with gtkagg backend on linux, and >> confirm the behavior with 0.99.0 with tkagg on OS X. >> >> Thanks, >> Jeff >> >> >> - >> >> - >> SOLARIS 10 is the OS for Data Centers - provides features such as >> DTrace, >> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW >> http://p.sf.net/sfu/solaris-dev2dev >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting multiline graph with large dataset (6 lines, about 30, 000, 000 points total
Oz Nahum wrote: > Here's a quick and dirty solution how to sample every nth element in a > vector - there's probably a faster way, with out loops, there sure is: In [8]: orig Out[8]: array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) In [9]: orig[0:-1:4] # every 4th element Out[9]: array([ 0, 4, 8, 12, 16]) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting multiline graph with large dataset (6 lines, about 30, 000, 000 points total
Hello Krishna, This is really crazy ploting so many data point, after all the human eye can't separate all the data. Try sampling the vector of the data point - to a smaller extent. Here's a quick and dirty solution how to sample every nth element in a vector - there's probably a faster way, with out loops, but this works for now $ python Python 2.5.5 (r255:77872, Feb 1 2010, 19:53:42) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from nupmy import arange Traceback (most recent call last): File "", line 1, in ImportError: No module named nupmy >>> from numpy import arange >>> a=arange(1,15) >>> a array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) >>> from numpy import zeros >>> a_sampled=zeros(5) >>> a_sampled array([ 0., 0., 0., 0., 0.]) >>> range(0,15,5) [0, 5, 10] >>> range(0,15,3) [0, 3, 6, 9, 12] >>> fileter_indecies=range(0,15,3) >>> for i in range(len(a_sampled)): ... a_sampled[i]=a[fileter_indecies[i]] ... >>> a_sampled array([ 1., 4., 7., 10., 13.]) I hope it helps -- Oz Nahum Graduate Student Zentrum für Angewandte Geologie Universität Tübingen --- Imagine there's no countries it isn't hard to do Nothing to kill or die for And no religion too Imagine all the people Living life in peace -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] LateX Legend (again)
Jeff, I send all of my figures through LaTeX and don't have this problem. The only thing I can think of is to check your matplotlibrc file and make sure you've set the legend font to be the same size as the other fonts. HTH, -paul h. > -Original Message- > From: Jeffrey Blackburne [mailto:je...@mit.edu] > Sent: Wednesday, February 10, 2010 9:45 AM > To: matplotlib-users@lists.sourceforge.net > Subject: [Matplotlib-users] LateX Legend (again) > > Hi everyone, > > This has been brought up before, but not completely addressed. Is it > possible to get the text in a Legend to match the rest of the text > when using LateX? Here is an example of the problem: > > import matplotlib as mpl > mpl.rcParams['text.usetex'] = True > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(111) > ax.plot([1,5,2,3]) # random data > plt.figlegend(ax.lines,[r'$\rm{label}$ label'],loc='upper left') > plt.show() > > The first word is at least in a roman font, but the font size is > wrong. I am using svn revision 8005 with gtkagg backend on linux, and > confirm the behavior with 0.99.0 with tkagg on OS X. > > Thanks, > Jeff > > > - > - > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Retake control of colorbar?
Dear all, This is probably a silly question based on my bias from matlab, but I have tried for two days without luck. I need to make pcolor plots in several figures, and the go back and add a scatter on each. This procedure is necessary due to how I read the data. My problem is that I can't figure out how update the colorbar in the end. An example is as follows: #= import random import pylab as pl import numpy as np from numpy.random import rand def pcl(fig,val): pl.figure(fig) pl.clf() pl.pcolor(val) pl.colorbar() def sct(fig,xvec,yvec,cvec): pl.figure(fig) pl.scatter(xvec,yvec,40,cvec) pl.xlim(0,10) pl.ylim(0,10) pl.colorbar(orientation='horizontal') pcl(1, rand(20,20)*10) pcl(2, rand(20,20)*10) pcl(3, rand(20,20)*10) sct(1,rand(10)*10,rand(10)*10,rand(10)*40) sct(2,rand(10)*10,rand(10)*10,rand(10)*40) sct(3,rand(10)*10,rand(10)*10,rand(10)*40) #= I would like the pcolor image and the colorbar to have the same clim extents as the scatter in the end. Is this in any way possible? Many thanks for any help! :-)Bror -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Retake control of colorbar?
Dear all, This is probably a silly question based on my bias from matlab, but I have tried for two days without luck. I need to make pcolor plots in several figures, and the go back and add a scatter on each. This procedure is necessary due to how I read the data. My problem is that I can't figure out how update the colorbar in the end. An example is as follows: #= import random import pylab as pl import numpy as np from numpy.random import rand def pcl(fig,val): pl.figure(fig) pl.clf() pl.pcolor(val) pl.colorbar() def sct(fig,xvec,yvec,cvec): pl.figure(fig) pl.scatter(xvec,yvec,40,cvec) pl.xlim(0,10) pl.ylim(0,10) pl.colorbar(orientation='horizontal') pcl(1, rand(20,20)*10) pcl(2, rand(20,20)*10) pcl(3, rand(20,20)*10) sct(1,rand(10)*10,rand(10)*10,rand(10)*40) sct(2,rand(10)*10,rand(10)*10,rand(10)*40) sct(3,rand(10)*10,rand(10)*10,rand(10)*40) #= I would like the pcolor image and the colorbar to have the same clim extents as the scatter in the end. Is this in any way possible? Many thanks for any help! :-)Bror -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] LateX Legend (again)
Hi everyone, This has been brought up before, but not completely addressed. Is it possible to get the text in a Legend to match the rest of the text when using LateX? Here is an example of the problem: import matplotlib as mpl mpl.rcParams['text.usetex'] = True import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.plot([1,5,2,3]) # random data plt.figlegend(ax.lines,[r'$\rm{label}$ label'],loc='upper left') plt.show() The first word is at least in a roman font, but the font size is wrong. I am using svn revision 8005 with gtkagg backend on linux, and confirm the behavior with 0.99.0 with tkagg on OS X. Thanks, Jeff -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] quiver + dates
Hello again, I managed to produce a nice stickplot, thanks to all again. Here is the script in case anyone is interested. http://dl.dropbox.com/u/4411725/plt-surf-flx.html Best, Filipe On Mon, Feb 8, 2010 at 9:57 AM, Filipe Pires Alvarenga Fernandes < ocef...@gmail.com> wrote: > Thanks, that worked perfectly. > > Best, Filipe > > > On Mon, Feb 8, 2010 at 8:39 AM, Stephane Raynaud < > stephane.rayn...@gmail.com> wrote: > >> Hi Filipe, >> >> you can fist use the quiver() function in the classic way for stick plots, >> then use gca().xaxis_date(). >> >> Here is a simple example : >> >> import pylab as P >> # t may be generated using date2num() >> t = P.arange(100,110,.1) >> u = P.sin(t) >> v = P.cos(t) >> P.quiver([t],[[0]*len(t)],u,v) >> P.gca().xaxis_date() >> P.show() >> >> >> On Sun, Feb 7, 2010 at 6:11 PM, Filipe Pires Alvarenga Fernandes < >> ocef...@gmail.com> wrote: >> >>> Hello list, >>> >>> I'm trying to create a stick-plot figure using the quiver function from >>> matplotlib. However, I'm failing miserably to plot dates in the x-axis. Has >>> anyone done this before? Also, is there an effort to create a stickplot >>> function? >>> >>> Thanks, Filipe >>> >>> * >>> Filipe Pires Alvarenga Fernandes >>> >>> University of Massachusetts Dartmouth >>> 200 Mill Road - Fairhaven, MA >>> Tel: (508) 910-6381 >>> Email: falvarengafernan...@umassd.edu >>> ocef...@yahoo.com.br >>> ocef...@gmail.com >>> >>> http://ocefpaf.tiddlyspot.com/ >>> * >>> >>> >>> -- >>> The Planet: dedicated and managed hosting, cloud storage, colocation >>> Stay online with enterprise data centers and the best network in the >>> business >>> Choose flexible plans and management services without long-term contracts >>> Personal 24x7 support from experience hosting pros just a phone call >>> away. >>> http://p.sf.net/sfu/theplanet-com >>> ___ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> >> >> -- >> Stephane Raynaud >> > > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plotting multiline graph with large dataset (6 lines, about 30, 000, 000 points total)
Hi, I am a beginner with matplotlib. I am trying to analyze huge dataset, the plot would have multiple lines. I am getting memory error (it fails maxing out ~2.5GB on my system). I am assuming there are probably ways to simplify the data, I came across something 'simplify' for 'path', not sure how to use that in my case. My code looks something as shown below (there are 2 ways I tried), as can be seen I am using lists, would converting them to numpy arrays significantly improve things? I am yet to try that. Simplifying function would be best I guess. The values on x-axis are cumulative measures (of memory of each element, element being some basic component in our system) and the y-axis shows percentage (obtained by some-count-of-the-element_times_memory-of-the-element/Sum of these for all elements). If this doesn't make sense, that's ok, the idea is the graph is expected to not contain sudden crests or troughs. Method1: xy_pairs = [x1_vals, y1_vals, x2_vals, y2_vals...] plt.plot(**xy_pairs) Method1: for each_xy_pair: plt.plot(x_vals, y_vals) Both of the above methods don't work. Thanks, Krishna. -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Sankey diagram
Hi, following my own post, I attach an upgraded version of the sankey.py script to draw single-direction Sankey diagrams. It now supports multiple inputs and double-sided diagrams (see attached example). Let me know if you find it useful, and/or have any comment. Cheers, -- .~. Yannick COPIN (o:>* Doctus cum libro /V\ Institut de physique nucleaire de Lyon (IN2P3 - France) // \\ Tel: (33/0) 472 431 968 AIM: YnCopin ICQ: 236931013 /( )\ http://snovae.in2p3.fr/ycopin/ ^`~'^ #!/usr/bin/env python __author__ = "Yannick Copin " __version__ = "Time-stamp: <10/02/2010 16:49 yco...@lyopc548.in2p3.fr>" import numpy as N def sankey(ax, outputs=[100.], outlabels=None, inputs=[100.], inlabels='', dx=40, dy=10, outangle=45, w=3, inangle=30, offset=2, **kwargs): """Draw a Sankey diagram. outputs: array of outputs, should sum up to 100% outlabels: output labels (same length as outputs), or None (use default labels) or '' (no labels) inputs and inlabels: similar for inputs dx: horizontal elongation dy: vertical elongation outangle: output arrow angle [deg] w: output arrow shoulder inangle: input dip angle offset: text offset **kwargs: propagated to Patch (e.g. fill=False) Return (patch,[intexts,outtexts]).""" import matplotlib.patches as mpatches from matplotlib.path import Path outs = N.absolute(outputs) outsigns = N.sign(outputs) outsigns[-1] = 0 # Last output ins = N.absolute(inputs) insigns = N.sign(inputs) insigns[0] = 0 # First input assert sum(outs)==100, "Outputs don't sum up to 100%" assert sum(ins)==100, "Inputs don't sum up to 100%" def add_output(path, loss, sign=1): h = (loss/2+w)*N.tan(outangle/180.*N.pi) # Arrow tip height move,(x,y) = path[-1] # Use last point as reference if sign==0: # Final loss (horizontal) path.extend([(Path.LINETO,[x+dx,y]), (Path.LINETO,[x+dx,y+w]), (Path.LINETO,[x+dx+h,y-loss/2]), # Tip (Path.LINETO,[x+dx,y-loss-w]), (Path.LINETO,[x+dx,y-loss])]) outtips.append((sign,path[-3][1])) else: # Intermediate loss (vertical) path.extend([(Path.CURVE4,[x+dx/2,y]), (Path.CURVE4,[x+dx,y]), (Path.CURVE4,[x+dx,y+sign*dy]), (Path.LINETO,[x+dx-w,y+sign*dy]), (Path.LINETO,[x+dx+loss/2,y+sign*(dy+h)]), # Tip (Path.LINETO,[x+dx+loss+w,y+sign*dy]), (Path.LINETO,[x+dx+loss,y+sign*dy]), (Path.CURVE3,[x+dx+loss,y-sign*loss]), (Path.CURVE3,[x+dx/2+loss,y-sign*loss])]) outtips.append((sign,path[-5][1])) def add_input(path, gain, sign=1): h = (gain/2)*N.tan(inangle/180.*N.pi) # Dip depth move,(x,y) = path[-1] # Use last point as reference if sign==0: # First gain (horizontal) path.extend([(Path.LINETO,[x-dx,y]), (Path.LINETO,[x-dx+h,y+gain/2]), # Dip (Path.LINETO,[x-dx,y+gain])]) xd,yd = path[-2][1] # Dip position indips.append((sign,[xd-h,yd])) else: # Intermediate gain (vertical) path.extend([(Path.CURVE4,[x-dx/2,y]), (Path.CURVE4,[x-dx,y]), (Path.CURVE4,[x-dx,y+sign*dy]), (Path.LINETO,[x-dx-gain/2,y+sign*(dy-h)]), # Dip (Path.LINETO,[x-dx-gain,y+sign*dy]), (Path.CURVE3,[x-dx-gain,y-sign*gain]), (Path.CURVE3,[x-dx/2-gain,y-sign*gain])]) xd,yd = path[-4][1] # Dip position indips.append((sign,[xd,yd+sign*h])) outtips = []# Output arrow tip dir. and positions urpath = [(Path.MOVETO,[0,100])]# 1st point of upper right path lrpath = [(Path.LINETO,[0,0])] # 1st point of lower right path for loss,sign in zip(outs,outsigns): add_output(sign>=0 and urpath or lrpath, loss, sign=sign) indips = [] # Input arrow tip dir. and positions llpath = [(Path.LINETO,[0,0])] # 1st point of lower left path ulpath = [(Path.MOVETO,[0,100])]# 1st point of upper left path for gain,sign in zip(ins,insigns)[::-1]: add_input(sign<=0 and llpath or ulpath, gain, sign=sign) def revert(path): """A path is not just revertable by path[::-1] because of Bezier curves.""" rpath = [] nextmove = Path.LINETO for move,pos in path[::-1]: rpath.append((next
Re: [Matplotlib-users] Sankey diagram
2010/2/9 Yannick Copin : > Hi List, > > I made a script to draw very simple (single-direction single-input > single-sided single-everything) Sankey diagrams (attached). I think I could > share, if it can be of any use... Great -- I had never heard of a Sankey diagram but just took a look on wikipedia. Very nice -- I contributed this to examples/api and it will show up on the web site and gallery after the mpl 1.0 release. Thanks for sending it! JDH -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Pick event and annotate
On Wed, Feb 10, 2010 at 4:43 AM, Nils Wagner wrote: > Hi all, > > How can I combine onpick events with annotate ? > Any pointer would be appreciated. > > import numpy as np > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(111) > ax.set_title('click on points') > > line, = ax.plot(np.random.rand(100), 'o', picker=5) # 5 > points tolerance > > def onpick(event): > thisline = event.artist > xdata = thisline.get_xdata() > ydata = thisline.get_ydata() > ind = event.ind > print 'onpick points:', zip(xdata[ind], ydata[ind]), > ind > ax.annotate('Test',xy=(ind, > ydata[ind]),horizontalalignment='left',verticalalignment='top') > # ax.redraw_in_frame() You need to call fig.canvas.draw() at the end of onpick. JDH > > fig.canvas.mpl_connect('pick_event', onpick) > > plt.show() > > > > Thanks in advance. > > Nils > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Runtime Error - Need Advice
Thanks for all your suggestions Christoph. Launching the Tk Python Shell instead of PythonWin seems to work consistently - I get the correct plot figure and the correct log_plot.png file created everytime I run the script. I never did install Ipython, but I'll consider that for a future upgrade. Lee Christoph Gohlke 02/09/2010 04:35 PM To matplotlib-users cc Subject Re: [Matplotlib-users] Runtime Error - Need Advice Caterpillar: Confidential Green Retain Until: 03/11/2010 I can now reproduce this. It seems the same old problem that PythonWin can not reliably run matplotlib because successive runs of the script use the same interpreter. Ipython should work. Append pylab.close() to your script; at least it will not crash on the second run. -- Christoph On 2/9/2010 10:44 AM, Lee Boger wrote: > > Although, if I close the figure then re-run the script, a new figure > pops up but it doesn't have any data plotted. Interpreter is now locked > up. I'm still not fixing it completely. There is also no figure stored > as a file log_plot. > > Lee > > > *Christoph Gohlke * > > 02/09/2010 01:23 PM > > > To >Lee Boger > cc > > Subject >Re: [Matplotlib-users] Runtime Error - Need Advice > > > > > > Caterpillar: Confidential GreenRetain Until: 03/11/2010 > > > > > Change the last line to pylab.show() and it should work. > > Anyway, this example should not crash the interpreter. I can reproduce > the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with > mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0. > > The shortest example that crashes is: > > python -c "import pylab;pylab.subplot(111).figure.show()" > > or on the interactive prompt: > import pylab pylab.subplot(111).figure.show() exit() > Fatal Python error: PyEval_RestoreThread: NULL tstate > > This application has requested the Runtime to terminate it in an unusual > way. > Please contact the application's support team for more information. > > > -- Christoph > > On 2/9/2010 7:57 AM, Lee Boger wrote: >> >> Windows XP Professional with Python 2.5 installed (pywin32 build 210) - >> came with dSPACE software package >> >> Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from >> sourceforge.net >> >> Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from >> sourceforge.net >> >> Executing the following simple "log plot" script within PythonWin: >> >> *from* matplotlib *import* pylab >> >> # Create some artificial data. >> test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, >> 17, 18, 19, 20] >> test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5, >> -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25] >> spec_frequency = [6, 8] >> spec_results = [-3.0, -3.0] >> >> # Plot >> figure = pylab.subplot(111) >> figure.semilogx() >> figure.scatter(test_frequency, test_results, s=20, c='b', marker='s', >> edgecolors='none') >> figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s', >> edgecolors='none') >> figure.grid(True) >> figure.set_xlabel(r"Frequency (Hz)", fontsize = 12) >> figure.set_ylabel(r"Actuator Response (db)", fontsize = 12) >> >> figure.figure.savefig('log_plot') >> figure.figure.show() >> >> >> Plots a figure on the screen that looks correct, then the following >> error (when I click OK, PythonWin closes) >> >> >> >> Any advice would be appreciated. Maybe it's an installation or setup >> issue, but I'm pretty knew to Python programming and don't know how to >> debug this. >> >> Lee Boger >> >> >> >> -- >> The Planet: dedicated and managed hosting, cloud storage, colocation >> Stay online with enterprise data centers and the best network in the > business >> Choose flexible plans and management services without long-term contracts >> Personal 24x7 support from experience hosting pros just a phone call away. >> http://p.sf.net/sfu/theplanet-com >> >> >> >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing li
Re: [Matplotlib-users] hatching problem
I noticed that the hatching looks wrong only when viewed i the OS X 'preview' software or for example inside of a Lyx document. But, when compiled into a DVI or PDF it looks fine. If I have a spare moment at some point I will give it a closer look. Tomek On 9 Feb 2010, at 23:56, Michiel de Hoon wrote: > I wasn't able to replicate this problem with the Mac OS X backend > with matplotlib 0.99.1.1. Both the on-screen figure and the ps > output look fine. > > --Michiel. > -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Pick event and annotate
Hi all, How can I combine onpick events with annotate ? Any pointer would be appreciated. import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('click on points') line, = ax.plot(np.random.rand(100), 'o', picker=5) # 5 points tolerance def onpick(event): thisline = event.artist xdata = thisline.get_xdata() ydata = thisline.get_ydata() ind = event.ind print 'onpick points:', zip(xdata[ind], ydata[ind]), ind ax.annotate('Test',xy=(ind, ydata[ind]),horizontalalignment='left',verticalalignment='top') # ax.redraw_in_frame() fig.canvas.mpl_connect('pick_event', onpick) plt.show() Thanks in advance. Nils -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] help with view_limits
Hi Che, I think turning off autoscaling is what you need: import matplotlib.pyplot as plt ax = plt.subplot(111, autoscaley_on=False, ylim=(0, 100)) plt.plot([1, 2], [-40, 40]) plt.show() Kind regards, Matthias On Monday 08 February 2010 20:49:50 C M wrote: > I'd like to set the ticks on the y axis such that they do not display > anything lower than 0, even if part of the graph below 0 is visible. > I tried to do this with > > ylocator = AutoLocator() > ylocator.view_limits(0, 100) > self.subplot.yaxis.set_major_locator(ylocator) > > but it is not changing anything. How can I do this? > > Thank you, > Che -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] his problems...
On Tuesday 09 February 2010 17:38:18 Nick Schurch wrote: > HI all, > > I've been using matplotlip for a while now but mainly for line plots, > scatter plots and the odd dendrogram. I recently tried plotting a > histogram (of a binomial function) and encountered a problem. So I > though I'd try the extremely simple example set on the front of the > matplotlib page and heres what I got: > > Python 2.4.3 (#1, Sep 3 2009, 15:37:12) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > > >>> from pylab import randn, hist > >>> x = randn(1) > >>> hist(x, 100) > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", line > 1633, in hist > ret = gca().hist(*args, **kwargs) > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 5060, in > hist align=align, log=log) > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 3253, in > bar assert len(height)==nbars, "argument 'height' must be %d or scalar" % > nbars AssertionError: argument 'height' must be 101 or scalar > > Any idea why this isn't working? I have matplotlib v0.91.2 - will > updating to 0.99 solve the problem? Hi, I'm using Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pylab import randn, hist, show >>> x = randn(1) >>> hist(x, 100) >>> show() >>> import matplotlib >>> matplotlib.__version__ '0.91.2' and get a nice figure with a 100-bins histogram. I don't know what's going wrong with your installation. Kind regards, Matthias -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Animation with many moving parts
I'm trying to do an animation which plots a large number of items on two dimensions, and then animates their positions over time. I have set up the plot with my dimensions on the axes and am using canvas.blit (as shown in one of the examples) to update my plot. I'm using text as the markers --- that is, I use the text function to display the label of each item (not just a point) at its location on the graph. The problem is that I have a large amount of data. There are over 100,000 "steps" in my time sequence (i.e., places where I might need to update the display because some item moved), and even though not all of those actually result in a change in the positions, there are still several thousand distinct items that need to be plotted and moved around. I'm currently buffering this a bit so that I only update on every Nth data point, but it's still rather slow. I can see one obvious, issue, but I'm not sure how to work around it. The thing is that a large number of the items don't actually move around very much over time, and even if one does move around relatively frequently, there may be long stretches where it doesn't. Yet, on every display update, I am redrawing all 1000+ artists. I feel like there should be some way to move only the points that need to be moved, but I'm not sure how to do it. My idea for how to improve it is that, for each display update, I would look at which bits of text actually do need to move, look at where they currently are, calculate which other texts overlap with those moving, then blit a blank rectangle onto the "old" positions of the moving items, and redraw only the moving items and those that were partially erased by the blank. This way items that were nowhere near any change wouldn't need to be redrawn. Is this feasible? Is there a standard way to go about this? Is there any way to figure out which artists overlap without looping over the list of all artists and checking the bbox bounds? Any other suggestions on how to do it? Thanks, -- Brendan Barnwell "Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail." --author unknown -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users