You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
1
(16) |
2
(16) |
3
(5) |
4
(4) |
5
(4) |
6
(10) |
7
(33) |
8
(11) |
9
(20) |
10
(7) |
11
(8) |
12
(18) |
13
(27) |
14
(21) |
15
(15) |
16
(10) |
17
(12) |
18
(3) |
19
(12) |
20
(12) |
21
(14) |
22
(32) |
23
(15) |
24
(20) |
25
(12) |
26
(32) |
27
(29) |
28
(17) |
29
(25) |
30
(12) |
31
(5) |
On Thu, Jul 8, 2010 at 8:41 AM, Jeremy Conlin <jlc...@gm...> wrote: > On Sun, Jul 4, 2010 at 8:38 PM, Benjamin Root <ben...@ou...> 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
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
On Fri, Jul 9, 2010 at 10:49 AM, Johannes Röhrs <joh...@me...> 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
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" <rm...@gm...> To: "Johannes Röhrs" <joh...@me...> Cc: mat...@li... 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 <joh...@me...> 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
On Fri, Jul 9, 2010 at 6:28 AM, Johannes Röhrs <joh...@me...> 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
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
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 <per...@gm...> 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 <rob...@gm...> 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 >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >
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 <rob...@gm...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
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
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 <ala...@gm...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
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_())
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
On Fri, Jul 9, 2010 at 7:25 AM, Karianne Holhjem <kar...@as...> 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
Hi, I changed the script to what you suggested and this is the output: [karianneholhjem:~] karianne% python bla.py --verbose-helpful $HOME=/Users/karianne CONFIGDIR=/Users/karianne/.matplotlib matplotlib data path /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/mpl-data loaded rc file /Users/karianne/.matplotlib/matplotlibrc matplotlib version 1.0.0 verbose.level helpful interactive is False units is False platform is darwin Bus error I get the same output when commenting out either line 2 or 3. (/Users/karianne/.matplotlib/matplotlibrc is just a link to /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/mpl-data/matplotlibrc as was in my previous output.) 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 I couldn't find the version requirements in the README file so I probably found the wrong README (/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/README.txt). It did provide a way of testing numpy, I don't know if it's interesting but here is the output: [karianneholhjem:/] karianne% python -c 'import numpy; numpy.test()' Running unit tests for numpy NumPy version 1.2.1 NumPy is installed in /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy Python version 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] nose version 0.11.3 ...........................................................................................................................................................................................................................................................................................................................................................................................................................................................K................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ ---------------------------------------------------------------------- Ran 1740 tests in 8.691s OK (KNOWNFAIL=1) Is there any more information I can provide to give you clues as of why pyplot and pylab aren't working? Thank you for your help so far, I did a course on python/numpy/matplotlib and I would really like to use matplotlib as it is a really powerful plotting tool! cheers, Karianne On Thu, 8 Jul 2010, John Hunter wrote: > On Thu, Jul 8, 2010 at 5:50 AM, Karianne Holhjem > <kar...@as...> wrote: > > Hi, > > > > I'm having trouble getting pyplot and pylab to work on my Mac v.10.4.11 > > (Tiger). I've tried searching in both google and different macusers > > forums, but haven't found an answer to my problems. If I have overlooked a > > webpage please send me a link to the solution. > > > > To download matplotlib I have downloaded the dmg package from the official > > matplotlib page > > http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/ > > > > and it seems to install fine. However, I cannot use neither pyplot nor > > pylab: > > > You're on the right track with the debugging information you are > trying to provide. One problem is in your script bla.py. You do > > import matplotlib as mpl > import mpl.pyplot > import mpl.pylab > > but you need to do > > import matplotlib as mpl > import matplotlib.pyplot > import matplotlib.pylab > > This won't fix your segfault, but it may help you get get better > debugging information. > > My first guess is a numpy version conflict -- what version are you > running? You can check the version requirements of the OSX installer > in the README that is provides. Many recent versions of numpy are not > ABI compatible, unfortunately. > > JDH >
Hi, 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] The problem is that C.set_array(f2) does not show any effect, not even after I call draw(). Shouldn't the array f2 be displayed after that? In comparison, the following code using imshow instead of contour works well: [code] figure() I=imshow(f1) show() I.set_data(f2) draw() [\code] What do I need to do to update an existing contour plot with new data? Greetings Johannes
Hi, I posted this to stackoverflow (http://stackoverflow.com/questions/3190798/scale-legend-box-border-dashed-and-dotted-lines-when-the-figure-size-is-changed), but didn't get any answer, so here goes again: I'm trying to use matplotlib to prepare some figures for publication. In order to make the font sizes match the text of the manuscript I'm trying to create the figure in the final size to begin with, so that I avoid scaling the figure when inserting it into the manuscript. The problem I'm having is that as the figure is then pretty small, I can scale font sizes, axis sizes, line widths etc., but what I've been unable to figure out is how to scale dashed or dotted lines, as well as the thickness of the legend border box. For a simplified and somewhat exaggerated example, consider #!/usr/bin/python small = True from matplotlib import use use('pdf') from matplotlib import rc rc('ps', usedistiller='xpdf') rc('text', usetex=True) if small: figsize = (1.0, 0.5) rc('font', size=2) rc('axes', labelsize=2, linewidth=0.2) rc('legend', fontsize=2, handlelength=10) rc('xtick', labelsize=2) rc('ytick', labelsize=2) rc('lines', lw=0.2, mew=0.2) rc('grid', linewidth=0.2) else: figsize = (8,8) import numpy as np x = np.arange(0, 10, 0.001) y = np.sin(x) import matplotlib.pyplot as plt f = plt.figure(figsize=figsize) a = f.add_subplot(111) a.plot(x, y, '--', label='foo bar') a.legend() f.savefig('mplt.pdf') If you change the first executable line to small = False you can see how it should look in "normal" size. Compared to the normal size, the small plot suffers from a legend box with too thick borders, and the dashed line is too coarse, i.e. too long dashes and too long distance between the dashes. So my question is, is there a way to fix these two problems? The matplotlib version I'm using is 0.99.1.2 on ubuntu 10.04 amd64. -- Janne Blomqvist
Dear Matplotlib developers, first of all my congratulations with the excellent 1.0 release, great work! I currently use a custom compiled 64 bit version of Python 2.6. But I would like to switch to the prebuild binaries for Python 2.7 as soon as possible. Are there any plans for supplying matplotlib 1.x dmg installers for Python 2.7 (including 64 bit support on OSX)? Kind regards, Pim Schellart P.S. I quickly tried compiling matplotlib from source against Python 2.7 which worked (after setting PREFIX=/usr/local and PYVERSION=2.7 in make.osx and compiling with sudo make -f make.osx fetch deps mpl_build mpl_install && sudo python setup.py install) but failed with a segfault on import.
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? thanks.