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
(3) |
2
(7) |
3
(13) |
4
(6) |
5
(18) |
6
(39) |
7
(1) |
8
(4) |
9
(4) |
10
(4) |
11
(19) |
12
(15) |
13
(16) |
14
(1) |
15
(5) |
16
(17) |
17
(12) |
18
(19) |
19
(2) |
20
(5) |
21
(3) |
22
(1) |
23
(3) |
24
(5) |
25
(4) |
26
(1) |
27
(13) |
28
(4) |
29
(2) |
30
(21) |
31
(17) |
|
|
|
|
From: Daniel M. <dan...@go...> - 2011-05-06 16:13:15
|
Very nice, will try this asap! Many thanks! 2011/5/6 Tony Yu <ts...@gm...>: > > On Fri, May 6, 2011 at 5:55 AM, Chris Rodgers <chr...@be...> > wrote: >> >> The real solution of course is to calculate exactly where every piece >> of text actually is, detect overlaps, and adjust. That is certainly >> beyond my ability or inclination to implement. In the mean time, it >> would be nice to have a simple "idiot-proof" flag that blindly fixes >> some common problems. > > I wrote a helper script awhile back to adjust spacing "automatically". > > Code can be found here: > http://www.mail-archive.com/mat...@li.../msg18107.html > > You can simply copy the code into a module (e.g. layout.py) that lives in > your python path, and then call "layout.tight_layout()" *right before* your > call to "plt.show()" (or "plt.savefig()"). > > It's pretty inefficient though because it has to draw the figure 3 different > times (once to calculate the size of subplots and again to calculate the > size of the figure, and then the final draw). There are some other issues, > which prevent inclusion in matplotlib (see discussion in link below), but it > works well for my purposes. > > Best, > -Tony > > Original post, with some discussion, can be found here: > http://www.mail-archive.com/mat...@li.../msg06896.html > > Note the code from the original post didn't work on some backends, so it's > probably best to use the code from the first link. |
From: Tony Yu <ts...@gm...> - 2011-05-06 15:56:46
|
On Fri, May 6, 2011 at 5:55 AM, Chris Rodgers <chr...@be...>wrote: > The real solution of course is to calculate exactly where every piece > of text actually is, detect overlaps, and adjust. That is certainly > beyond my ability or inclination to implement. In the mean time, it > would be nice to have a simple "idiot-proof" flag that blindly fixes > some common problems. > I wrote a helper script awhile back to adjust spacing "automatically". Code can be found here: http://www.mail-archive.com/mat...@li.../msg18107.html You can simply copy the code into a module (e.g. layout.py) that lives in your python path, and then call "layout.tight_layout()" *right before* your call to "plt.show()" (or "plt.savefig()"). It's pretty inefficient though because it has to draw the figure 3 different times (once to calculate the size of subplots and again to calculate the size of the figure, and then the final draw). There are some other issues, which prevent inclusion in matplotlib (see discussion in link below), but it works well for my purposes. Best, -Tony Original post, with some discussion, can be found here: http://www.mail-archive.com/mat...@li.../msg06896.html Note the code from the original post didn't work on some backends, so it's probably best to use the code from the first link. |
From: Francesco B. <fra...@bs...> - 2011-05-06 15:11:01
|
> Hi all, > I've noticed that there are some islands missing from the basemap, > such as Balearic Islands and Canary Islands. I've fixed, the problem was that I'm using the python wrapper for grads, that set the default area threshold to 10000 km ... I hope this can help someone else, bye. -- ---------------------------------------------------------------------- Francesco Benincasa Research Support Engineer - Earth Sciences Department Barcelona Supercomputing Center - Centro Nacional de Supercomputación Edificio Nexus II c/ Jordi Girona 29, 08034 Barcelona, Spain phone +34 934137612 fax +34 934137721 mailto: fra...@bs... BSC web page: http://www.bsc.es/ ---------------------------------------------------------------------- WARNING / LEGAL TEXT: This message is intended only for the use of the individual or entity to which it is addressed and may contain information which is privileged, confidential, proprietary, or exempt from disclosure under applicable law. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, you are strictly prohibited from disclosing, distributing, copying, or in any way using this message. If you have received this communication in error, please notify the sender and destroy and delete any copies you may have received. http://www.bsc.es/disclaimer.htm |
From: Utopian <ika...@ya...> - 2011-05-06 15:10:03
|
Hello everyone! I want to extract colors from the colormap example: import matplotlib.cm as cm color1=cm.jet(20) Now I need to get colors from the discrete colorbar there is a working code how to create discrete colormap: http://www.scipy.org/Cookbook/Matplotlib/ColormapTransformations Discrete colormap I make same thing with: newcbar=cmap_discretize(cm.jet,100) # jet is devided by 100 parts color2=newcbar(20) surprisingly color2 is different than color1. I dont understand why. Could you please give me an idea how to create a discrete colorbar and extract color? -- View this message in context: http://old.nabble.com/getting-colors-from-the-discrete-color-bar-tp31559720p31559720.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Benjamin R. <ben...@ou...> - 2011-05-06 14:34:00
|
On Thu, May 5, 2011 at 10:01 PM, C M <cmp...@gm...> wrote: > > Because you have a py2exe'ed program, I suspect that whoever packaged the > > program should be the one to modify that program to choose its axes > limits > > more robustly in order to avoid the warning message. > > Maybe I have been unclear. I am the sole developer of this > application, and I occasionally test it as a py2exe'd app in > anticipation of delivering it in that form at some point. I would be > happy to modify the program to choose its axes limits more > robustly--if I only knew how to do that. That is what I am asking. > How should I do that? > > The data to be plotted is a very simple date plot with dates on the x > axis and values (formatted as time) on the y axis. > > Che > Most likely, somewhere in your code, you have a call to set_ylim(), and are likely setting it to the minimum and maximum values of the data you are plotting. This is where the problem comes in. There are several options to go about avoiding the problem here. One is to not call set_ylim() at all if you have only one data point, and just let matplotlib figure out the y-limits automatically. Another approach is to call set_ylim() with parameters that have an explicit amount of padding, like the following: ax.set_ylim(y.min() - 0.5, y.max() + 0.5) This way, you are guaranteed that the top and bottom limits will never be the same. The best approach is up to you. I hope that helps! Ben Root |
From: Johann G. <jg...@uc...> - 2011-05-06 12:11:09
|
> Hi Michael, > > I use fill_between() and log axis without problems in the following way (it's by memory, I hope the sintax is correct) > > fig = plt.figure() > spl = fig.add_subplot(111) > > spl.fill_between(x,y1,y2) > > spl.set_yscale("log") > > plt.show() > > Cheers, > > Fra > > Il giorno 06/mag/2011, alle ore 01.34, Benjamin Root ha scritto: > > > > > > > On Tue, May 3, 2011 at 3:40 AM, K.-Michael Aye <kmi...@gm...> wrote: > > A colleague posed an interesting challenge: > > How to do a filled plot having the y-axis in logarithm? > > I think I can do it with creating patches myself an adding it to the > > axis, but isn't there anything built-in? > > > > Best regards, > > Michael > > > > > > > > Does fill_between() not work for you? Note, I have never tried it on a log scale plot. > > > > Ben Root > > > Another couple things you may find useful as I did: fig = pyplot.figure() spl = fig.add_subplot(111) to properly "clip" the plot in case you are using polygons or similar, you can use the nonposy option: spl.set_yscale('log', nonposy='clip') Here is my hand made formula for setting reasonable limits on the y-axis, given a numpy.array "yarr" as the list of y-values. The ymin gets the minimum value that's not zero since you can't plot zero on a log scale (negative numbers may cause a whole other problem): spl.set_ylim( ymin = 10**(int(math.log(min(yarr[numpy.where(yarr>0)]), 10))-1), ymax = 10**(int(math.log(max(yarr), 10)+0.2)+1) ) --Johann |
From: Alan G I. <ala...@gm...> - 2011-05-06 12:08:01
|
On 5/6/2011 7:57 AM, Vikram K wrote: > > I wish to draw a Venn diagram depicting five events and their intersections. Can't be done: http://www.brynmawr.edu/math/people/anmyers/PAPERS/Venn.pdf hth, Alan Isaac |
From: Vikram K <kpg...@gm...> - 2011-05-06 11:57:26
|
This works for four events and their intersections but how do i add the fifth event along with all intersections? from matplotlib import pyplot as plt from matplotlib.patches import Circle f = plt.figure() ax = f.gca() rad = 1.4 c1 = Circle((-1,0),rad, alpha=.2, fc ='red') c2 = Circle((1,0),rad, alpha=.2, fc ='blue') c3 = Circle((0,1),rad, alpha=.2, fc ='green') c4 = Circle((0,-1),rad, alpha=.2, fc ='yellow') ax.add_patch(c1) ax.add_patch(c2) ax.add_patch(c3) ax.add_patch(c4) ax.set_xlim(-3,3) ax.set_ylim(-3,3) plt.show() ---------- Forwarded message ---------- From: Vikram K <kpg...@gm...> Date: Fri, May 6, 2011 at 7:43 AM Subject: Venn diagram for five events To: mat...@li... I wish to draw a Venn diagram depicting five events and their intersections. I came across some code for three events--could someone please direct me about how i could modify it for five events. from matplotlib import pyplot as plt from matplotlib.patches import Circle f = plt.figure() ax = f.gca() rad = 1.4 c1 = Circle((-1,0),rad, alpha=.2, fc ='red') c2 = Circle((1,0),rad, alpha=.2, fc ='blue') c3 = Circle((0,1),rad, alpha=.2, fc ='green') ax.add_patch(c1) ax.add_patch(c2) ax.add_patch(c3) ax.set_xlim(-3,3) ax.set_ylim(-3,3) plt.show() |
From: Vikram K <kpg...@gm...> - 2011-05-06 11:43:45
|
I wish to draw a Venn diagram depicting five events and their intersections. I came across some code for three events--could someone please direct me about how i could modify it for five events. from matplotlib import pyplot as plt from matplotlib.patches import Circle f = plt.figure() ax = f.gca() rad = 1.4 c1 = Circle((-1,0),rad, alpha=.2, fc ='red') c2 = Circle((1,0),rad, alpha=.2, fc ='blue') c3 = Circle((0,1),rad, alpha=.2, fc ='green') ax.add_patch(c1) ax.add_patch(c2) ax.add_patch(c3) ax.set_xlim(-3,3) ax.set_ylim(-3,3) plt.show() |
From: Francesco B. <fra...@bs...> - 2011-05-06 09:56:41
|
Hi all, I've noticed that there are some islands missing from the basemap, such as Balearic Islands and Canary Islands. Any suggestion to fix it? Thank you very much in advance. -- ---------------------------------------------------------------------- Francesco Benincasa Research Support Engineer - Earth Sciences Department Barcelona Supercomputing Center - Centro Nacional de Supercomputación Edificio Nexus II c/ Jordi Girona 29, 08034 Barcelona, Spain phone +34 934137612 fax +34 934137721 mailto: fra...@bs... BSC web page: http://www.bsc.es/ ---------------------------------------------------------------------- WARNING / LEGAL TEXT: This message is intended only for the use of the individual or entity to which it is addressed and may contain information which is privileged, confidential, proprietary, or exempt from disclosure under applicable law. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, you are strictly prohibited from disclosing, distributing, copying, or in any way using this message. If you have received this communication in error, please notify the sender and destroy and delete any copies you may have received. http://www.bsc.es/disclaimer.htm |
From: Chris R. <chr...@be...> - 2011-05-06 09:55:42
|
Since I just posted an almost-identical question, it's no surprise that I agree this would be a useful feature. Reason #1) I create hundreds of quick throwaway figures every day, often in an automated way, and don't have time to fine-tune them. Reason #2) a newbie to matplotlib might be turned off by one "ugly" figure, when in fact matplotlib is capable of producing beautiful figures. The previous suggestion I received was to create a convenience wrapper for the subplot function with some idiot-proof defaults. Can you propose a set of rcParams that satisfies this criterion? This one fixes the specific issue you raise: matplotlib.rcParams['figure.subplot.hspace'] = .5 Although it will rear its ugly head again once the number of subplots reaches 5 or 6. Personally I rarely use more than 4x4, and if I did I would certainly increase the figsize. I find that setting all text sizes to be as small as possible also helps. My most commonly encountered issue is overlapping x-tick labels, because most of my plots have "samples" on the x-axis and therefore hundreds of thousands of points. The real solution of course is to calculate exactly where every piece of text actually is, detect overlaps, and adjust. That is certainly beyond my ability or inclination to implement. In the mean time, it would be nice to have a simple "idiot-proof" flag that blindly fixes some common problems. On Fri, May 6, 2011 at 1:20 AM, Daniel Mader <dan...@go...> wrote: > Hi, > > almost every time I create a somewhat more complex figure I have to > fight with the not too smart positioning of the plots and the size of > margins around the axes. From many postings here I have learned that > this is the absolute intention, i.e. it is broken by design unless the > programmer takes care about this. > > I have to admin that I do not really get this idea. I am aware that > the defaults will not change anytime soon and so I'd like to ask for > an "idiot-proof" mode: this could be enabled by an rcParam and take > care of proper dimensions, scale axis labels, titles, margins etc so > that they don't cover. > > Here's an example for a matplotlib script which is a simple as it can > get and demonstrates the broken layout which a user gets by default. > > import scipy > import pylab > > x = scipy.linspace(-50,50, 100) > y1 = scipy.rand(100) > y2 = scipy.sin(x) > y3 = y1 + y2 > > fig = pylab.figure() > ax1 = fig.add_subplot(311) > ax2 = fig.add_subplot(312) > ax3 = fig.add_subplot(313) > > ax1.plot(x, y1) > ax2.plot(x, y2) > ax3.plot(x, y3) > > ax1.set_title('some title') > ax2.set_title('some title') > ax3.set_title('some title') > > pylab.show() > > Of course, one can adjust the figsize but the results are still far > from being adorable. The spacing around the sublplots increases for no > apparent reason while the spacing between the subplot remains the same > so that everything looks cramped... > > > Thank you many times in advance, > best regards, > > Daniel > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Daniel M. <dan...@go...> - 2011-05-06 08:20:51
|
Hi, almost every time I create a somewhat more complex figure I have to fight with the not too smart positioning of the plots and the size of margins around the axes. From many postings here I have learned that this is the absolute intention, i.e. it is broken by design unless the programmer takes care about this. I have to admin that I do not really get this idea. I am aware that the defaults will not change anytime soon and so I'd like to ask for an "idiot-proof" mode: this could be enabled by an rcParam and take care of proper dimensions, scale axis labels, titles, margins etc so that they don't cover. Here's an example for a matplotlib script which is a simple as it can get and demonstrates the broken layout which a user gets by default. import scipy import pylab x = scipy.linspace(-50,50, 100) y1 = scipy.rand(100) y2 = scipy.sin(x) y3 = y1 + y2 fig = pylab.figure() ax1 = fig.add_subplot(311) ax2 = fig.add_subplot(312) ax3 = fig.add_subplot(313) ax1.plot(x, y1) ax2.plot(x, y2) ax3.plot(x, y3) ax1.set_title('some title') ax2.set_title('some title') ax3.set_title('some title') pylab.show() Of course, one can adjust the figsize but the results are still far from being adorable. The spacing around the sublplots increases for no apparent reason while the spacing between the subplot remains the same so that everything looks cramped... Thank you many times in advance, best regards, Daniel |
From: Andreas R. <and...@tu...> - 2011-05-06 08:04:06
|
Hi Ben, Thanks anyway for your answer! Aki Benjamin Root wrote: > > > On Tue, Mar 29, 2011 at 8:35 AM, Andreas Reisinger > <and...@tu... <mailto:and...@tu...>> > wrote: > > Hi! > > I would like to save a pyplot object as it is, including axes, lines, > text, etc. into a file. > When opening it again, I want to be able to add additional axes, lines > and so on. > > Unfortunately pickle does not handle the pyplot object and gives me an > error. > > Anyone knows a solution? > > All the best > Aki > > > This has been an often requested feature, but much harder to implement > than expected. There is currently no known solution to this problem, > but I certainly would hope that it becomes possible. > > Sorry I could not be of more help. > Ben Root > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Alexander D. <ale...@go...> - 2011-05-06 07:25:57
|
Hi Benjamin, thanks for your answer - I feared you would reply as you did. I will have a look at mayavi then. Thanks Alex On Fri, May 6, 2011 at 00:24, Benjamin Root <ben...@ou...> wrote: > On Thursday, May 5, 2011, Alexander Dietz > <ale...@go...> wrote: > > Hi, > > > > I have the following situation. I have been following the example to > create a 3d surface, as explained here: > > > > http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo2.html > > > > and I have altered the code slightly to plot a straight red line from the > center outside of the sphere (see code at the end of this email). As one can > see, the whole line is visible always, no matter how the sphere is turned. > Is there a way to 'hide' those parts of the red line, which are 'behind' the > blue surface? Like you stick a pencil into an apple and turn the apple, so > you can see parts of the pencil, depending on how the apple is rotated > (except the part of the pencil inside the apple)? > > > > If someone can help me with that problem that would be great. > > > > > > Thanks > > Alex > > > > > > > > > > > > > > from mpl_toolkits.mplot3d import Axes3D > > import matplotlib.pyplot as plt > > import numpy as np > > > > fig = plt.figure() > > #ax = fig.add_subplot(111, projection='3d') > > ax = Axes3D(fig) > > > > u = np.linspace(0, 2 * np.pi, 100) > > v = np.linspace(0, np.pi, 100) > > > > x = 10 * np.outer(np.cos(u), np.sin(v)) > > y = 10 * np.outer(np.sin(u), np.sin(v)) > > z = 10 * np.outer(np.ones(np.size(u)), np.cos(v)) > > > > ax.plot([0,15],[0.0,0.0],'r', lw=4) > > > > ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b') > > > > plt.show() > > > > Mplot3d is not a true 3d plotting system. I would recommend mayavi > for that. Because mplot3d is a hack to render 3d objects with a 2d > rendering system, matplotlib can't get the the layering right. Maybe > in the far future this will be changed, but for now, it is a design > limitation. > > Ben > |
From: Francesco M. <fra...@go...> - 2011-05-06 07:25:46
|
Hi Michael, I use fill_between() and log axis without problems in the following way (it's by memory, I hope the sintax is correct) fig = plt.figure() spl = fig.add_subplot(111) spl.fill_between(x,y1,y2) spl.set_yscale("log") plt.show() Cheers, Fra Il giorno 06/mag/2011, alle ore 01.34, Benjamin Root ha scritto: > > > On Tue, May 3, 2011 at 3:40 AM, K.-Michael Aye <kmi...@gm...> wrote: > A colleague posed an interesting challenge: > How to do a filled plot having the y-axis in logarithm? > I think I can do it with creating patches myself an adding it to the > axis, but isn't there anything built-in? > > Best regards, > Michael > > > > Does fill_between() not work for you? Note, I have never tried it on a log scale plot. > > Ben Root > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd_______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Benjamin R. <ben...@ou...> - 2011-05-06 04:33:51
|
On Thursday, May 5, 2011, Nate Gallagher <nat...@ya...> wrote: > Is there a list archive I can search to see if a question has been asked before? > Thanks, > Nate > http://old.nabble.com/matplotlib---users-f2906.html There are others as well. These are good formviewing the archives. But for searches, I just use google with matplotlib as the first term. Most results usually point to a thread archived on nabble anyway. I hope that helps! Ben Root |
From: Nate G. <nat...@ya...> - 2011-05-06 04:17:47
|
Is there a list archive I can search to see if a question has been asked before? Thanks, Nate |
From: C M <cmp...@gm...> - 2011-05-06 03:01:30
|
> Because you have a py2exe'ed program, I suspect that whoever packaged the > program should be the one to modify that program to choose its axes limits > more robustly in order to avoid the warning message. Maybe I have been unclear. I am the sole developer of this application, and I occasionally test it as a py2exe'd app in anticipation of delivering it in that form at some point. I would be happy to modify the program to choose its axes limits more robustly--if I only knew how to do that. That is what I am asking. How should I do that? The data to be plotted is a very simple date plot with dates on the x axis and values (formatted as time) on the y axis. Che |
From: Benjamin R. <ben...@ou...> - 2011-05-06 02:21:12
|
On Thu, May 5, 2011 at 9:04 PM, C M <cmp...@gm...> wrote: > On Thu, May 5, 2011 at 10:03 PM, C M <cmp...@gm...> wrote: > > On Thu, May 5, 2011 at 7:58 PM, Benjamin Root <ben...@ou...> wrote: > >> > >> > >> On Sun, May 1, 2011 at 4:35 PM, C M <cmp...@gm...> wrote: > >>> > >>> I get this error and would like to know what to do to eliminate it and > >>> also what it means: > >>> > >>> C:\Python25\lib\site-packages\matplotlib\axes.py:2571: > >>> UserWarning: Attempting to set identical bottom==top results > >>> in singular transformations; automatically expanding. > >>> bottom=0, top=0 + 'bottom=%s, top=%s') % (bottom, top)) > >>> > >>> This is with Matplotlib 1.0.0. > >>> > >>> Thank you, > >>> Che > >>> > >> > > I have seen this happen when the plot is set to use the limits of the > data > > to guide the axes limits, but the data being displayed is either vertical > or > > horizontal. > > What do you mean by the data being vertical or horizontal? I can get > this error with a single point that is plotted on a time vs. values > plot. > > Or even a single point. In other words, if the bounding box encompassing the data being plotted can be reduced to a 1 or 0 dimensional representation, then matplotlib will auto-pad this so that the rest of matplotlib won't crash. > > It isn't a huge issue as the code is automatically padding the > > axes to make take the plot out of "flat world". > > The problem is, when I use a py2exe'd app this error occurs and the > user sees a message to see the log file for the error. I don't want > that at all. It's a bad user experience. > The warning message is important because it is usually an indication that the program is doing something wrong. If you (and by "you", I mean the program) might be plotting a single point or something that can be reduced to 1 or 0 dimensions, then you should not have the axes automatically set its limits from the data without pads. Because you have a py2exe'ed program, I suspect that whoever packaged the program should be the one to modify that program to choose its axes limits more robustly in order to avoid the warning message. Unless the other developers feel differently, I am against suppressing this warning message. I hope that makes things clearer. Ben Root |
From: Benjamin R. <ben...@ou...> - 2011-05-06 02:11:38
|
On Thu, May 5, 2011 at 7:16 PM, Paul Leopardi <pau...@ii...>wrote: > [Repost from 21 Mar 2011: note suggested patches] > > Hi all, > I am using Matplotlib 1.0.1 and am seeing weird behaviour with mplot3d and > ticker formatters, and I think I need to submit a patch to axes3d, but am > not > sure how much it will break, because format_zdata() and format_coord() look > to > be defined inconsistently. > > When trying to rotate a plot, which was created including the following > commands, > ... > ax.plot(x[0,alow:atop],x[1,alow:atop],x[2,alow:atop],c=rgb.tolist()) > ax.w_xaxis.set_major_locator(tic.LinearLocator(3)) > ax.w_xaxis.set_major_formatter(tic.FormatStrFormatter('')) > ax.w_yaxis.set_major_locator(tic.LinearLocator(3)) > ax.w_yaxis.set_major_formatter(tic.FormatStrFormatter('')) > ax.w_zaxis.set_major_locator(tic.LinearLocator(3)) > ax.w_zaxis.set_major_formatter(tic.FormatStrFormatter('')) > plt.draw() > ... > > I received the following backtrace and error message: > > /usr/lib64/python2.6/site-packages/matplotlib/backend_bases.pyc in > mouse_move(self, event) > 2393 if event.inaxes and event.inaxes.get_navigate(): > 2394 > -> 2395 try: s = event.inaxes.format_coord(event.xdata, > event.ydata) > 2396 except ValueError: pass > 2397 except OverflowError: pass > > /usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in > format_coord(self, xd, yd) > 474 > 475 xs = self.format_xdata(x) > --> 476 ys = self.format_ydata(y) > 477 zs = self.format_ydata(z) > 478 return 'x=%s, y=%s, z=%s' % (xs, ys, zs) > > /usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in > format_ydata(self, y) > 424 except TypeError: > 425 fmt = self.w_yaxis.get_major_formatter() > --> 426 return sensible_format_data(fmt, y) > 427 > 428 def format_zdata(self, z): > > /usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in > sensible_format_data(self, value) > 26 if abs(value) > 1e4 or abs(value)<1e-3: > 27 s = '%1.4e' % value > ---> 28 return self._formatSciNotation(s) > 29 else: > 30 return '%4.3f' % value > > AttributeError: FormatStrFormatter instance has no attribute > '_formatSciNotation' > > --- > I am using FormatStrFormatter('') to try to obtain an empty tick. > > [1] It looks like sensible_format_data() assumes that self is class > ScalarFormatter(Formatter), since this is the only ticker Formatter that > has > attribute _formatSciNotation(s). As far as I can tell, this means that > sensible_format_data(fmt,y) should *only* be called if fmt has class > ScalarFormatter(Formatter). > > > [2] In axes3d.py, I see: > > def format_zdata(self, z): > """ > Return z string formatted. This function will use the attribute > self.fmt_zdata if it is callable, else will fall back on the yaxis > major formatter > """ > try: > return self.fmt_zdata(z) > except (AttributeError, TypeError): > fmt = self.w_zaxis.get_major_formatter() > return sensible_format_data(fmt, z) > > To me, it looks like the call to sensible_format_data(fmt, z) is wrong. The > same error occurs in format_xdata() and format_ydata(). So I would like to > submit a patch for format_xdata(), format_ydata(), format_zdata(), e.g.: > > def format_zdata(self, z): > """ > Return z string formatted. This function will use the attribute > self.fmt_zdata if it is callable, else will fall back on the zaxis > major formatter > """ > try: > return self.fmt_zdata(z) > except (AttributeError, TypeError): > fmt = self.w_zaxis.get_major_formatter() > try: > return sensible_format_data(fmt, z) > except (AttributeError, TypeError): > return format_data(fmt, z) > > > [3] But I am also worried about the comment "else will fall back on the > yaxis > major formatter". Shouldn't this say "the zaxis major formatter", since > that > is what the code does? Or should the code use the yaxis major formatter, > since > that is what the documentation says? The documentation > http://matplotlib.github.com/mpl_toolkits/mplot3d/api.html agrees with the > comment and not with the code. > > > [4] In def format_coord(self, xd, yd), I see > > xs = self.format_xdata(x) > ys = self.format_ydata(y) > zs = self.format_ydata(z) > > Why doesn't the last line say > zs = self.format_zdata(z) > ? > > Best, Paul > > Paul, This is a perfect example of the "with many eyes, all bugs are shallow" saying. I have been running into problems with this with respect to getting log scales to work. While your fixes doesn't completely address the issue, it does bring me a few steps closer. Your hunches are correct. There have been plenty of copy-n-paste mistakes within mplot3d, and it makes no sense to fall back onto the y-axis formatter. Also, note that the documentation is automatically generated from the string comments, so it is no surprise that they match. I will make a patch for this for master and hopefully v1.0.x. Thank you, Ben Root |
From: C M <cmp...@gm...> - 2011-05-06 02:05:21
|
On Thu, May 5, 2011 at 10:03 PM, C M <cmp...@gm...> wrote: > On Thu, May 5, 2011 at 7:58 PM, Benjamin Root <ben...@ou...> wrote: >> >> >> On Sun, May 1, 2011 at 4:35 PM, C M <cmp...@gm...> wrote: >>> >>> I get this error and would like to know what to do to eliminate it and >>> also what it means: >>> >>> C:\Python25\lib\site-packages\matplotlib\axes.py:2571: >>> UserWarning: Attempting to set identical bottom==top results >>> in singular transformations; automatically expanding. >>> bottom=0, top=0 + 'bottom=%s, top=%s') % (bottom, top)) >>> >>> This is with Matplotlib 1.0.0. >>> >>> Thank you, >>> Che >>> >> > I have seen this happen when the plot is set to use the limits of the data > to guide the axes limits, but the data being displayed is either vertical or > horizontal. What do you mean by the data being vertical or horizontal? I can get this error with a single point that is plotted on a time vs. values plot. > It isn't a huge issue as the code is automatically padding the > axes to make take the plot out of "flat world". The problem is, when I use a py2exe'd app this error occurs and the user sees a message to see the log file for the error. I don't want that at all. It's a bad user experience. Is there a way I can prevent this error from ever being generated? Thanks. |
From: Benjamin R. <ben...@ou...> - 2011-05-06 01:44:00
|
On Tue, Mar 29, 2011 at 8:35 AM, Andreas Reisinger < and...@tu...> wrote: > Hi! > > I would like to save a pyplot object as it is, including axes, lines, > text, etc. into a file. > When opening it again, I want to be able to add additional axes, lines > and so on. > > Unfortunately pickle does not handle the pyplot object and gives me an > error. > > Anyone knows a solution? > > All the best > Aki > > This has been an often requested feature, but much harder to implement than expected. There is currently no known solution to this problem, but I certainly would hope that it becomes possible. Sorry I could not be of more help. Ben Root |
From: Benjamin R. <ben...@ou...> - 2011-05-06 01:39:33
|
On Thu, Mar 31, 2011 at 7:42 PM, Eddie Schlafly <sch...@ho...>wrote: > Hi all, > > I was surprised today to notice that "subplot" was the slowest part of some > plotting code of mine. > > On my machine, the last line of the following code puts ten subplots on a > figure and records the amount of time it took to make them: > > >>> import matplotlib > >>> matplotlib.use('AGG') > >>> import time > >>> from matplotlib.pyplot import * > >>> def f(): > ... t = time.time() > ... clf() > ... for i in xrange(10): > ... subplot(5,2,i+1) > ... return time.time()-t > ... > >>> > >>> times = [f() for x in xrange(10)] > > This code gives me a bunch of times that are on average about half a > second. I expected it to be much faster as I wasn't actually plotting > anything. > > Is this expected? Can I choose a faster backend or something? I've > experimented a little but without success. I realize that 5 hundredths of a > second per subplot isn't terrifically slow, ... but I guess I make a lot of > plots. > > Thanks a lot, > > Eddie Schlafly > > Eddie, Calling pyplot.subplot() may be slow because it has to determine which figure is the currently active figure, and then create a new axes object for that figure. I would suspect that passing in the figure object and calling add_subplot from the figure may speed things up. Also note that v1.0.0 introduced pyplot.subplots() which will create a figure, and an array of subplots all at once. There is also the gridspec method that might also be of interest. I hope that helps! Ben Root |
From: Benjamin R. <ben...@ou...> - 2011-05-06 01:34:50
|
On Thu, Apr 7, 2011 at 10:41 AM, Jeroen DR <voe...@gm...>wrote: > Hi, > > I'm using the method described on > http://matplotlib.sourceforge.net/faq/howto_faq.html#howto-auto-adjust > to automatically adjust my subplot figures to make room for my axis > labels. I'm not drawing my graphs to the screen, but I'm instead > outputting them to PNG files using a savefig("filename.png", dpi=100) call. > > I'm on a Ubuntu 9.04 Jaunty Jackalope system, so I originally used the > python-matplotlib package for convenience, which contains matplotlib > 0.98.5.2. However, I later also needed the option to move my legend on > top of my figure, which means that I had to upgrade to at least > matplotlib 0.99.x since I would need the bbox_to_anchor kwarg for that. > Naturally nothing higher than 0.98 is available for Ubuntu 9.04, so I > went and installed MPL from source. That worked, until I discovered that > now the draw_event no longer fires when I call savefig(). It still fires > for show(), but for some reason, after installing from source, it no > longer does. I made sure that I installed all of MPL's dependencies; the > build report lists version numbers for all them where it didn't before, > so I'm pretty sure those are all satisfied. > > Here's the test program I used, adapted directly from the sample code. I > also tried adding in manual fig.canvas.draw() calls to try and trigger > the event manually, which seemingly are all happily ignored. > > import matplotlib.pyplot as plt > import matplotlib.transforms as mtransforms > fig = plt.figure() > ax = fig.add_subplot(111) > ax.plot(range(10)) > ax.set_yticks((2,5,7)) > labels = ax.set_yticklabels(('really, really, really', 'long', 'labels')) > > def on_draw(event): > print "on_draw" > bboxes = [] > for label in labels: > bbox = label.get_window_extent() > # the figure transform goes from relative coords->pixels and we > # want the inverse of that > bboxi = bbox.inverse_transformed(fig.transFigure) > bboxes.append(bboxi) > > # this is the bbox that bounds all the bboxes, again in relative > # figure coords > bbox = mtransforms.Bbox.union(bboxes) > if fig.subplotpars.left < bbox.width: > # we need to move it over > fig.subplots_adjust(left=1.1*bbox.width) # pad a little > fig.canvas.draw() > return False > > fig.canvas.mpl_connect('draw_event', on_draw) > > #plt.show() # this fires draw_event > plt.savefig('delete_me.png', dpi=100) # this doesn't > > Convinced this was a bug, I then tried compiling a whole bunch of > different versions from source to see what version it stopped working > at. It didn't work for any of them, including the 0.98.5.x builds. > Finally, I tried grabbing python-matplotlib's matplotlibrc file and > using it to override the compiled version's RC file with, and lo: > draw_event fires again. > > I'm not very familiar with MPL's internals so I'm sure there's a reason > for this (one thing I immediately noticed was that the DEB RC file seems > to use the TkAgg backend, whereas the compiled version uses the GTKAgg > backend). However, it feels to me like whether or not a "user-mode" > event fires or not should not depend on some configuration settings. > > I've yet to figure out which setting exactly causes draw_event to fail, > but I just wanted to let you guys know; might be a good idea to tweak > the default settings so that draw_event behaves as expected. > > Cheers, > Jeroen DR > > I wonder if this is backend-dependent. Which backend are you using for the installs from source? Ben Root |
From: Gerald S. <gd...@mr...> - 2011-05-06 01:32:26
|
Ah, I did not know that. I shall investigate. Thanks, Gerald. On 6/05/2011 7:27 AM, Benjamin Root wrote: > > > On Tue, May 3, 2011 at 3:57 AM, Gerald Storer <gd...@mr... > <mailto:gd...@mr...>> wrote: > > Hello, > > I've been trying to animate some plots with the qt backend and run > into > a couple of problems. > > Firstly, > I'd like to be able to update the axis limits in an automated > fashion as > the data changes size. > > Secondly, > Resizing figures appears to redraw everything _but_ items with the > animation flag. The is causing me problems when the animation is > paused > or the frames are occurring slow enough such that there is a noticable > period where the my lines disappear. > > I've sort of solved both of these problems but the solutions seem > hackish. In particular updating the axis limits is slowing the > animation by 25% and toggling the animated field using the qt events > just feels like its asking for trouble. > > Below is the qt animation example with my solutions. Adjust the > size of > the plot after the animation finishes to see the effect of the resize > hack. I would be grateful if anyone could suggest some improvements. > > Thanks, > Gerald. > > # For detailed comments on animation and the techniqes used here, see > > # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations > > import os > > import sys > > #import matplotlib > > #matplotlib.use('Qt4Agg') > > from matplotlib.figure import Figure > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg > as FigureCanvas > > from PyQt4 import QtCore, QtGui > > ITERS = 100 > > import numpy as np > > import time > > class BlitQT(FigureCanvas): > > def __init__(self): > > FigureCanvas.__init__(self, Figure()) > > self.ax <http://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.old_limits = self.ax.get_xlim(),self.ax.get_ylim() > > self.tstart = time.time() > > self.maintimer = self.startTimer(10) > > ## HACK for disapearing objects on resize > > def resizeEvent(self,evt): > > super(BlitQT,self).resizeEvent(evt) > > self.sin_line.set_animated(False) > > def paintEvent(self,evt): > > super(BlitQT,self).paintEvent(evt) > > self.sin_line.set_animated(True) > > 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) > > # update the data > > > self.sin_line.set_ydata(np.sin(self.x+self.cnt/10.0)*self.cnt/100.0) > > > self.cos_line.set_ydata(np.cos(self.x+self.cnt/10.0)*self.cnt/100.0) > > ## HACK for updating axis limits > > self.ax.relim() > > self.ax.autoscale_view() > > current_limits = self.ax.get_xlim(),self.ax.get_ylim() > > if self.old_limits != current_limits: > > self.old_limits = current_limits > > self.draw() > > self.ax_background = self.copy_from_bbox(self.ax.bbox) > > self.blit(self.figure.bbox) > > > > # 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() > > self.killTimer(self.maintimer) > > else: > > self.cnt += 1 > > app = QtGui.QApplication(sys.argv) > > widget = BlitQT() > > widget.show() > > sys.exit(app.exec_()) > > > Gerald, > > I haven't looked at your code, but I would like to point out that if > you wish to experiment a little further with animations in matplotlib, > there is a animation module that is in the current development branch > (but has not been officially released). Maybe using it might help > make your code less "hack-ish"? We would also greatly welcome any and > all comments on the module before the next release of matplotlib. > > Ben Root > -- Gerald Storer | MRX Technologies +61 8 9227 4529 | gd...@mr... <mailto:gd...@mr...> | http://www.mrxtech.com.au |