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
|
2
(13) |
3
(5) |
4
(5) |
5
(21) |
6
(10) |
7
(9) |
|
8
(4) |
9
(11) |
10
(9) |
11
(11) |
12
(25) |
13
(5) |
14
(2) |
|
15
(5) |
16
(8) |
17
(16) |
18
(11) |
19
(15) |
20
(5) |
21
(8) |
|
22
(4) |
23
(24) |
24
(9) |
25
(14) |
26
(5) |
27
(28) |
28
(2) |
|
29
(13) |
30
(14) |
31
(11) |
|
|
|
|
|
From: Neal B. <ndb...@gm...> - 2012-01-25 18:50:58
|
Ethan Swint wrote: > > > On 1/25/2012 1:32 PM, Neal Becker wrote: >> I have a legend that is going to have some abbreviations to compactly >> indicate >> the properties of different lines in a graph. I'd like to add a little 'key' >> to >> explain what the notation means. Any suggestion? > I was thinking of the annotate functionality, but on second thought, I > think you are looking for something like > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.text > > Regards, > Ethan Thanks. Since the text is to explain the legend, I wanted to put it as part of the legend box - either above or below the rest of the legend. |
|
From: Ethan S. <es...@vt...> - 2012-01-25 18:47:53
|
On 1/25/2012 1:32 PM, Neal Becker wrote: > I have a legend that is going to have some abbreviations to compactly indicate > the properties of different lines in a graph. I'd like to add a little 'key' to > explain what the notation means. Any suggestion? I was thinking of the annotate functionality, but on second thought, I think you are looking for something like http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.text Regards, Ethan |
|
From: Neal B. <ndb...@gm...> - 2012-01-25 18:33:14
|
I have a legend that is going to have some abbreviations to compactly indicate the properties of different lines in a graph. I'd like to add a little 'key' to explain what the notation means. Any suggestion? |
|
From: Daπid <dav...@gm...> - 2012-01-25 15:54:24
|
http://matplotlib.sourceforge.net/examples/api/demo_affine_image_00.html This link of the gallery example is broken (error 404). It corresponds to the third example of the fourth row. |
|
From: Mike M. <mmu...@py...> - 2012-01-25 15:43:17
|
Hi, I will be giving a matplotlib and a optimization tutorial at PyCon in March. So please point people to it who would like to have a compact introduction to matplotlib. The optimization tutorial gives an overview over this topic. BTW, the early bird deadline is today. Mike Plotting with matplotlib ------------------------ Instructor: Mike Müller Type:Tutorial Audience level:Novice Category:Useful libraries March 8th 9 a.m. – 12:20 p.m. https://us.pycon.org/2012/schedule/presentation/238/ When it comes to plotting with Python many people think about matplotlib. It is widely used and provides a simple interface for creating a wide variety of plots from very simple diagrams to sophisticated animations. This tutorial is a hands-on introduction that teaches the basics of matplotlib. Students will learn how to create publication-ready plots with just a few lines of Python. Faster Python Programs through Optimization ------------------------------------------- Instructor: Mike Müller Type:Tutorial Audience level:Experienced Category:Best Practices/Patterns March 7th 9 a.m. – 12:20 p.m. https://us.pycon.org/2012/schedule/presentation/245/ This tutorial provides an overview of techniques to improve the performance of Python programs. The focus is on concepts such as profiling, difference of data structures and algorithms as well as a selection of tools and libraries that help to speed up Python. |
|
From: Fabien L. <laf...@gm...> - 2012-01-25 15:42:51
|
Since I use" twiny" the button on the menu which allow color changing, log scale and so on, doesn't work. Why? What can I do? thx, Fabien |
|
From: Paul H. <pmh...@gm...> - 2012-01-25 15:25:26
|
I always taylor a matplotlibrc file for a given project, but you can modify the rc parameters on the fly: http://matplotlib.sourceforge.net/users/customizing.html#dynamic-rc-settings You need to set themodified rc parameters at the top of your script. Hope that helps. -paul On Wed, Jan 25, 2012 at 4:29 AM, Martella, C. <cla...@vu...> wrote: > hello list, > > I'm having quite a big number of subplots all together inside of the same figure, which pushes me to reduce the font size quite a lot to avoid overlap. > I've been able to set quite everything, except of the ytickslabels: > > sp = fig.add_subplot(611, xlim=(10, 100)) > sp.set_title(my_title, fontsize='small') > sp.set_xticklabels(('10', '15', '20', '30', '45', '60', '75', '90'), fontsize='small') > sp.set_xticks(X) > sp.set_ylabel('Y', fontsize='small') > #sp.set_yticklabels(sp.get_yticklabels(), fontsize='small') > sp.plot(X, Y, "b--") > > unfortunately I can't set yticklabes without passing the labels as well, which i'd like to avoid as it really much depends on the data and the subplot. I'm happy with matplotlib calculating the yticklabels the way it does, i just would like to have control over their fonts size. > > Any idea? > > -- > Claudio Martella > cla...@vu... > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Tony Yu <ts...@gm...> - 2012-01-25 14:38:04
|
On Wed, Jan 25, 2012 at 7:14 AM, andi <and...@go...> wrote: > Hi Tony, > > thanks for your reply! I am not using the pdf backend, but the GTKAgg > backend. Is it working with this backend in the development version? > > Cheers > Andi > Hi Andi, Unfortunately, I can't run the GTKAgg backend, but I checked your code snippet on the backends I have on my system. It seems this behavior is really inconsistent: Works: * agg * qt4agg * tkagg Doesn't work: * pdf * macosx To be honest, I don't understand the magical workings of the backends very well. I've copied the developer list since the consistency of backends seems like a relevant issue. -Tony P.S. Andi: Be sure to "reply all" since the mailing list doesn't automatically do this for some reason. > > On 25/01/12 00:26, Tony Yu wrote: > > > > On Tue, Jan 24, 2012 at 12:53 PM, andi <and...@go...> wrote: > >> Hi all, >> >> I have some old custom code for generating videos from matplotlib (not >> using the animation module). It used to work, but is now failing. >> Here is what I am doing: >> >> ------------------- >> import matplotlib.pyplot as plt >> import numpy as np >> >> fig = plt.figure() >> ax = fig.add_subplot(111) >> im = ax.imshow(np.zeros((100, 100))) >> fig.canvas.draw() >> ax.draw_artist(im) >> ------------------ >> >> ... and draw_artist from axes.py then gives me an AssertionError because >> no renderer is found (assert self._cachedRenderer is not None). >> >> Right now I am using matplotlib 1.0.1 and I think that the above used to >> work with older versions in matplotlib. See e.g. >> >> http://www.mail-archive.com/mat...@li.../msg06598.html >> >> Any ideas? >> >> Cheers >> Andi >> >> > Hi Andi, > > I'm running a development version of matplotlib, and your code runs > without issue. That doesn't really solve your issue, but it means that it's > not due to deprecation. > > On a hunch, I tried running the code with > >>> import matplotlib > >>> matplotlib.use('pdf') > at the top of the file, and I got the same error. Not really sure why, > though. Do you happen to have the pdf backend set as the default? > > -Tony > > |
|
From: Moore, E. (NIH/N. [F] <eri...@ni...> - 2012-01-25 13:46:37
|
> -----Original Message----- > From: alw46 [mailto:ama...@gm...] > Sent: Tuesday, January 24, 2012 3:40 PM > To: mat...@li... > Subject: Re: [Matplotlib-users] Plotting contour in X-Z plane > > > Hi Eric, > > First, thanks for the sample - I agree that it's a neat example and I > really > appreciate the help. > > Second, I've tried to adapt your code to my specific situation and I'm > running into a problem: it's not printing all the levels that I'm > specifying. Do you have any insights into why? I can't seem to find > any > documentation on the cntr.cntr method, so I'm just trial-and-erroring > it for > now. Running the code you posted, I don't see any failures. The simplest way to check if is producing all of the contours that it should is to use the contour() function to plot the contours in each plane separately, and see that what it plots is identical to what contour3D() plots in each plane. When I do that, everything looks okay. For instance, in the v[:,:,0] plane, the nominally missing contours are at 3, 3.1111, and 3.2222. However, if we ask if we should see these contours, by evaluating v[:,:,0].min() = 3.307, the answer is no, since they are all smaller than the minimum v in that plane. I haven't repeated this analysis for the other 9 planes, but I suspect it also follows there. For reference, the Cntr object is defined by mpl as a C extension (code here: https://github.com/matplotlib/matplotlib/blob/master/src/cntr.c ). To display the small amount of help that it comes with call help(cntr.Cntr) in ipython. (Using cntr.Cntr? won't find the help.) I think that the entire cntr module is really an internal detail, hence the lack of user facing documentation. > > I'd like it to print more than 6 contour levels (why did you have this > limit?), so I changed your error statement. I've also used a 10x10x10 > grid, > and put in my own data for the 'v' set. I limited it to 6 levels since my mesh was much denser and really with more than 1 or 2 levels there were too many lines to see anything useful. Rotating the view also becomes slow if the number of lines becomes excessively large. > > Also, I've simplified it so that it's only displaying in the X-Y plane, > and > so that it's only displaying one "slice" in that plane. I'm asking it > to > display contours every 0.1, between 3.0 and 4.0, but some contours are > missing, and come up as empty arrays when I print 'c'. FYI, your code does r_[3:4:10j] which gives 3.0 to 4.0 inclusive in steps of 1/9, rather than steps of 1/10, since when called this way r_[] is endpoint inclusive. > > I've uploaded the modified file. > > http://old.nabble.com/file/p33197575/cntr3d_alw.py cntr3d_alw.py > > Thanks! > Amanda > > Best, Eric |
|
From: Martella, C. <cla...@vu...> - 2012-01-25 12:30:14
|
hello list,
I'm having quite a big number of subplots all together inside of the same figure, which pushes me to reduce the font size quite a lot to avoid overlap.
I've been able to set quite everything, except of the ytickslabels:
sp = fig.add_subplot(611, xlim=(10, 100))
sp.set_title(my_title, fontsize='small')
sp.set_xticklabels(('10', '15', '20', '30', '45', '60', '75', '90'), fontsize='small')
sp.set_xticks(X)
sp.set_ylabel('Y', fontsize='small')
#sp.set_yticklabels(sp.get_yticklabels(), fontsize='small')
sp.plot(X, Y, "b--")
unfortunately I can't set yticklabes without passing the labels as well, which i'd like to avoid as it really much depends on the data and the subplot. I'm happy with matplotlib calculating the yticklabels the way it does, i just would like to have control over their fonts size.
Any idea?
--
Claudio Martella
cla...@vu...
|
|
From: Tobias W. <wi...@ph...> - 2012-01-25 11:23:54
|
Hi, the Basemap allskymap example (examples/allskymap.py in current git and basemap rev 1.0.2) plots buggy tissots if they cross the zero meridian and/or the poles (see http://web.physik.rwth- aachen.de/~winchen/unfixed_polarRegions_llskymap.png ). The attached patch fixes this issue (see http://web.physik.rwth- aachen.de/~winchen/fixed_polarRegions_llskymap.png ). Best regards. Tobias |
|
From: Mike M. <mmu...@py...> - 2012-01-24 20:52:29
|
Course "Python for Scientists and Engineers" in Chicago ======================================================= There will be a comprehensive Python course for scientists and engineers in Chicago end of February / beginning of March 2012. It consists of a 3-day intro and a 2-day advanced section. Both sections can be taken separately or combined. More details below and here: http://www.dabeaz.com/chicago/science.html Please let friends or colleagues who might be interested in such a course know about it. 3-Day Intro Section ------------------- - Overview of Scientific and Technical Libraries for Python. - Numerical Calculations with NumPy - Storage and Processing of Large Amounts of Data - Graphical Presentation of Scientific Data with matplotlib - Object Oriented Programming for Scientific and Technical Projects - Open Time for Problem Solving 2-Day Advanced Section ---------------------- - Extending Python with Other Languages - Unit Testing - Version Control with Mercurial The Details ----------- The course is hosted by David Beazley (http://www.dabeaz.com). Date: Feb 27 - Mar 2, 2012 Location: Chicago, IL, USA Trainer: Mike Müller Course Language: English Link: http://www.dabeaz.com/chicago/science.html |
|
From: alw46 <ama...@gm...> - 2012-01-24 20:40:12
|
Hi Eric, First, thanks for the sample - I agree that it's a neat example and I really appreciate the help. Second, I've tried to adapt your code to my specific situation and I'm running into a problem: it's not printing all the levels that I'm specifying. Do you have any insights into why? I can't seem to find any documentation on the cntr.cntr method, so I'm just trial-and-erroring it for now. I'd like it to print more than 6 contour levels (why did you have this limit?), so I changed your error statement. I've also used a 10x10x10 grid, and put in my own data for the 'v' set. Also, I've simplified it so that it's only displaying in the X-Y plane, and so that it's only displaying one "slice" in that plane. I'm asking it to display contours every 0.1, between 3.0 and 4.0, but some contours are missing, and come up as empty arrays when I print 'c'. I've uploaded the modified file. http://old.nabble.com/file/p33197575/cntr3d_alw.py cntr3d_alw.py Thanks! Amanda -- View this message in context: http://old.nabble.com/Plotting-contour-in-X-Z-plane-tp33168965p33197575.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: andi <and...@go...> - 2012-01-24 17:53:24
|
Hi all, I have some old custom code for generating videos from matplotlib (not using the animation module). It used to work, but is now failing. Here is what I am doing: ------------------- import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(111) im = ax.imshow(np.zeros((100, 100))) fig.canvas.draw() ax.draw_artist(im) ------------------ ... and draw_artist from axes.py then gives me an AssertionError because no renderer is found (assert self._cachedRenderer is not None). Right now I am using matplotlib 1.0.1 and I think that the above used to work with older versions in matplotlib. See e.g. http://www.mail-archive.com/mat...@li.../msg06598.html Any ideas? Cheers Andi |
|
From: Gousios G. <gg...@wi...> - 2012-01-24 15:20:41
|
Στις 24/01/2012 01:31 μμ, ο/η Gousios George έγραψε: > Στις 23/01/2012 08:39 μμ, ο/η Tony Yu έγραψε: >> >> >> 2012/1/23 Gousios George <gg...@wi... >> <mailto:gg...@wi...>> >> >> Στις 23/01/2012 08:10 μμ, ο/η Benjamin Root έγραψε: >>> 2012/1/23 Gousios George <gg...@wi... >>> <mailto:gg...@wi...>> >>> >>> Στις 23/01/2012 07:48 μμ, ο/η Tony Yu έγραψε: >>>> >>>> >>>> 2012/1/23 Gousios George <gg...@wi... >>>> <mailto:gg...@wi...>> >>>> >>>> Στις 23/01/2012 06:52 μμ, ο/η Tony Yu έγραψε: >>>>> >>>>> >>>>> 2012/1/23 Gousios George <gg...@wi... >>>>> <mailto:gg...@wi...>> >>>>> >>>>> Στις 21/01/2012 07:43 μμ, ο/η Gousios George έγραψε: >>>>>> Στις 21/01/2012 07:05 μμ, ο/η Tony Yu έγραψε: >>>>>>> >>>>>>> >>>>>>> On Sat, Jan 21, 2012 at 11:31 AM, Gousios George >>>>>>> <gg...@wi... >>>>>>> <mailto:gg...@wi...>> wrote: >>>>>>> >>>>>>> Στις 21/01/2012 04:54 μμ, ο/η Tony Yu έγραψε: >>>>>>>> >>>>>>>> >>>>>>>> On Sat, Jan 21, 2012 at 9:07 AM, Gousios >>>>>>>> George <gg...@wi... >>>>>>>> <mailto:gg...@wi...>> wrote: >>>>>>>> >>>>>>>> Hello , i have the following code in >>>>>>>> matlab and trying to do it in >>>>>>>> matplotlib. >>>>>>>> >>>>>>>> I have this code in matlab (in a >>>>>>>> function showGraphs): >>>>>>>> ... >>>>>>>> m = size(myList, 3); >>>>>>>> for k = 1:m >>>>>>>> g = myList(:, :, k); >>>>>>>> image(g + 1) >>>>>>>> axis off >>>>>>>> axis square >>>>>>>> M(k) = getframe; >>>>>>>> end; >>>>>>>> >>>>>>>> and in another file (another function): >>>>>>>> ... >>>>>>>> M = showGraphs(grids) >>>>>>>> movie(M, 1) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> I did so far: >>>>>>>> >>>>>>>> def showGraphs(data): >>>>>>>> data=sc.array([data]) >>>>>>>> n=sc.shape(data)[2] >>>>>>>> for k in range(n): >>>>>>>> mydata=data[:,:,k] >>>>>>>> #plt.imshow(mydata+1) -->> >>>>>>>> this doesn't work >>>>>>>> >>>>>>>> Also ,in order to do the animation : >>>>>>>> >>>>>>>> grids=...(result from another function) >>>>>>>> result=showGraph(grids) >>>>>>>> fig=plt.figure() >>>>>>>> ani=animation.FuncAnimation(fig,result,interval=30,blit=True) >>>>>>>> plt.show() >>>>>>>> >>>>>>>> Right now the program says "TypeError: >>>>>>>> 'NoneType' object is not >>>>>>>> callable" (it has errors in the >>>>>>>> animation call) >>>>>>>> >>>>>>>> What should be my approach to this in >>>>>>>> order to have the animation? >>>>>>>> >>>>>>>> Thank you! >>>>>>>> >>>>>>>> >>>>>>>> You're getting that error because the >>>>>>>> second argument to FuncAnimation (`result` >>>>>>>> in your example) should be a function (not >>>>>>>> always; see example 2 linked below). Right >>>>>>>> now, if your `showGraphs` function is >>>>>>>> defined in full, it returns a value of >>>>>>>> None, which gets saved to `result` (hence >>>>>>>> the error). >>>>>>>> >>>>>>>> You should take a look at some of the image >>>>>>>> animation examples (ex1 >>>>>>>> <http://matplotlib.sourceforge.net/examples/animation/dynamic_image.html>, >>>>>>>> ex2 >>>>>>>> <http://matplotlib.sourceforge.net/examples/animation/dynamic_image2.html>). >>>>>>>> >>>>>>>> -Tony >>>>>>>> >>>>>>> >>>>>>> I did now : >>>>>>> >>>>>>> >>>>>>> def showGraphs(data): >>>>>>> data=sc.array([data]) >>>>>>> n=sc.shape(data)[2] >>>>>>> ims=[] >>>>>>> >>>>>>> for k in range(n): >>>>>>> mydata=data[:,:,k] >>>>>>> im=plt.imshow(mydata+1) >>>>>>> ims.append([im]) >>>>>>> return ims >>>>>>> >>>>>>> and now it gives me "TypeError: Invalid >>>>>>> dimensions for image data. >>>>>>> >>>>>>> >>>>>>> Please post short, but executable examples when >>>>>>> possible. I'm not sure what your data looks >>>>>>> like, but your call to `sc.array` is strange >>>>>>> (I'm not sure why you have square brackets, >>>>>>> which effectively adds an unnecessary dimension >>>>>>> to your data). >>>>>>> >>>>>>> The code attached below should work. >>>>>>> >>>>>>> Cheers, >>>>>>> -Tony >>>>>>> >>>>>>> import numpy as np >>>>>>> import matplotlib.pyplot as plt >>>>>>> from matplotlib.animation import ArtistAnimation >>>>>>> >>>>>>> >>>>>>> fig = plt.figure() >>>>>>> >>>>>>> def showGraphs(data): >>>>>>> data = np.asarray(data) # unnecessary in >>>>>>> this example >>>>>>> n = np.shape(data)[2] >>>>>>> >>>>>>> ims = [] >>>>>>> #for mydata in np.rollaxis(data, -1): >>>>>>> for k in range(n): >>>>>>> mydata = data[:, :, k] >>>>>>> im = plt.imshow(mydata) >>>>>>> ims.append([im]) >>>>>>> return ims >>>>>>> >>>>>>> # 5 frames of a random 20 x 20 image >>>>>>> data = np.random.uniform(size=(20, 20, 5)) >>>>>>> ims = showGraphs(data) >>>>>>> >>>>>>> ani = ArtistAnimation(fig, ims) >>>>>>> plt.show() >>>>>> Now,it gives me 2 figures (why 2?) but >>>>>> empty.(maybe i didn't convert right the matlab >>>>>> code below?) >>>>>> The data in the showGraphs function is the result >>>>>> from this function (in matlab): >>>>>> ......... >>>>>> grids = zeros(n, n, t + 1); >>>>>> grids(:, :, 1) = rest; >>>>>> for i = 2:(t + 1) >>>>>> Extended = extendLat1(rest); >>>>>> rest = applyExtended(Extended); >>>>>> grids(:, :, i) = rest; >>>>>> end; >>>>>> >>>>>> And i did this in python: >>>>>> >>>>>> grids=sc.zeros((area,area,t+1)) >>>>>> rest=grids[:,:,0] >>>>>> for i in range(1,t): >>>>>> extended=extend(rest) >>>>>> rest=apply_extend(extended) >>>>>> grids[:,:,i]=rest >>>>>> return grids >>>>>> >>>>>> Thanks for helping! >>>>>> >>>>> Any help?Thanks! >>>>> >>>>> Sorry, but could you be a bit clearer: >>>>> * Did the example I provide work for you? >>>>> * Assuming it did, are you essentially replacing >>>>> `data` in my example with `grids` in this most recent >>>>> example? >>>>> * I don't get 2 figures: are you asking about the code >>>>> from my last message? >>>>> * Please provide a minimal, *executable* example >>>>> >>>>> -Tony >>>> Ok,i 'll try! >>>> >>>> 1) Yes,your example works fine. >>>> 2) Yes,i return grids from another function (work) doing : >>>> >>>> grids=work(area,...,time) >>>> result=showGraphs(grids) >>>> ani=ArtistAnimation(fig,result) >>>> plt.show() >>>> >>>> The contents of the work function are shown above. >>>> I just want to make sure that i have done the >>>> conversion from matlab right. >>>> Maybe the problem is somewhere else? >>>> >>>> Thank you. >>>> >>>> >>>> Did you get 2 figures with my original example, or just in >>>> your modified code? If it's only in your modified code, >>>> then there's something you're not showing which is creating >>>> the extra figure. >>>> >>>> Unfortunately, the `work` function you showed in the >>>> previous message is not executable (`apply_extend`, >>>> `extend`, etc. aren't defined), which it makes it very >>>> difficult to debug. If my code snippet worked for you, then >>>> the only difference is in how you've defined `grids`---do >>>> you know how it's different? >>>> >>>> -Tony >>>> >>> Ok,i am sending you the whole code of the program. (forget >>> the names of the functions i showed you so far , i use other >>> names). >>> >>> EMPTY=0 #empty cell >>> TREE=1 #tree cell >>> BURNING=2 #burning cell >>> probTree=0.8 #probability of tree >>> probBurning=0.001 #a tree ignites with this probability >>> even if no neighbor is burning >>> probLighting=0.0001 #chance that a tree been hit from light >>> probResistBurn=0.3 #chance that a tree does not burn even >>> if it's neighbor burns >>> t=20 >>> area=50 >>> >>> >>> def spread(cell,N,E,S,W): >>> >>> if cell==EMPTY: >>> return EMPTY >>> elif cell==BURNING: >>> return EMPTY >>> else: >>> if (N==BURNING or E==BURNING or S==BURNING or >>> W==BURNING): >>> if (sc.rand()<probResistBurn): >>> return TREE >>> else: >>> return BURNING >>> elif (sc.rand()<probLighting *(1-probResistBurn)): >>> return BURNING >>> else: >>> return TREE >>> >>> def extend(lat): >>> lat = sc.matrix(lat) >>> extendRows= sc.vstack([lat[-1,:], lat, lat[0,:]]) >>> extendLat=sc.hstack([extendRows[:,-1], extendRows, >>> extendRows[:,0]]) >>> return extendLat >>> >>> def apply_extend(matr): >>> #matr = sc.matrix(matr) >>> matr=sc.array([matr]) >>> area=sc.shape(matr)[0] >>> final=sc.zeros((area,area)) >>> for i in range(1,area): >>> for j in range(1,area): >>> cell=matr[i,j] >>> N=matr[i-1,j] >>> E=matr[i,j+1] >>> S=matr[i+1,j] >>> W=matr[i,j-1] >>> final[i-1,j-1]=spread(cell,N,E,S,W) >>> return final >>> >>> def >>> fire(area,probTree,probBurning,probLighting,probResistBurn,t): >>> >>> trees_or_burns=sc.rand(area,area)<probTree # tree or a >>> burning tree >>> burns=trees_or_burns*(sc.rand(area,area)<probBurning) >>> # burning tree >>> trees=trees_or_burns-burns >>> # tree >>> empties=sc.ones((area,area))-trees_or_burns >>> # empty cell >>> >>> forest=empties*EMPTY + trees*TREE + burns*BURNING #the >>> whole forest >>> >>> grids=sc.zeros((area,area,t+1)) >>> forest=grids[:,:,0] >>> for i in range(1,): >>> extended_forest=extend(forest) >>> forest=apply_extend(extended_forest) >>> grids[:,:,i]=forest >>> return grids >>> >>> def Graph(data): >>> data=sc.array(data) >>> n=sc.shape(data)[2] >>> ims=[] >>> for i in range(n): >>> mydata=data[:,:,i] >>> im=plt.imshow(mydata) >>> >>> ims.append([im]) >>> return ims >>> >>> >>> if __name__=="__main__": >>> >>> grids=fire(area,probTree,probBurning,probLighting,probResistBurn,t) >>> result=Graph(grids) >>> fig=plt.figure() >>> >>> #ani=animation.FuncAnimation(fig,result,interval=30,blit=True,repeat_delay=1000) >>> ani=ArtistAnimation(fig,result) >>> plt.show() >>> >>> Also, i am sending you the code in matlab : >>> >>> >>> >>> In Graph(), you call "plt.imshow()", which will create a new >>> figure automatically if one doesn't exist already. Change >>> fig=plt.figure() to fig=plt.gcf() >>> >>> Ben Root >>> >> Ok,now it shows me only one figure but it's full of blue color >> and doesn't do anything. >> Thanks >> >> Actually, it's plotting your data correctly. If you print out the >> values of `mydata` in the `Graph` loop, you'll see that everything is >> zero. >> >> -Tony > You are right they are all zeros!I don't unsderstand.. > > I am not sure if the function extend causes the problem. > > The extend function from matlab is : > > function extlat = extendLat1(lat); > extendRows = [lat(end, :); lat; lat(1, :)]; > extlat = [extendRows(:, end) extendRows extendRows(:, 1)]; > > I tested my version and i am sure that it gives the right results.But > here,in matlab it has "lat" as argument . In python i create "lat = > sc.matrix(lat)" .I think this is right?? > > Also , the function apply_extend in matlab is: > > function newmat = applyExtended(matExt); > n = size(matExt, 1) - 2; > newmat = zeros(n); > for i = 2:(n + 1) > for j = 2:(n + 1) > site = matExt(i, j); > N = matExt(i - 1, j); > E = matExt(i, j + 1); > S = matExt(i + 1, j); > W = matExt(i, j - 1); > newmat(i - 1, j - 1) = spread(site, N, E, S, W); > end; > end; > > I think i have done it right. > > Also ,the function fire in matlab : > > function grids = fire(n, probTree, probBurning, chanceLightning, > chanceImmune, t); > > global EMPTY TREE BURNING probLightning probImmune > EMPTY = 0; TREE = 1; BURNING = 2; > probLightning = chanceLightning; > probImmune = chanceImmune; > > treesOrBurns = (rand(n) < probTree); > > burns = treesOrBurns .* (rand(n) < probBurning); > > trees = treesOrBurns - burns; > > empties = 1 - treesOrBurns; > > forest = empties * EMPTY + trees * TREE + burns * BURNING; > > grids = zeros(n, n, t + 1); > grids(:, :, 1) = forest; > for i = 2:(t + 1) > forestExtended = extendLat1(forest); > forest = applyExtended(forestExtended); > grids(:, :, i) = forest; > end; > > > Could someone figure where am i doing wrong?(i have the whole code of > mine above). > > Thanks! > Ok, i figured the error! It was at the "forest=grids[:,:,0]".It should be "grids[:,:,0]=forest". Now i want to ask 2 questions. 1) How to stop the animation??It should stop when the simulation ends but now it starts all over again. 2) How to use colormaps ,because i didn't understand from here <http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps> or here <http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps>. And how can i put specific colors for specific values.For example for my value "EMPTY->color white",TREE->color green. Thank you! |
|
From: John H. <jd...@gm...> - 2012-01-24 13:02:53
|
On Jan 24, 2012, at 6:06 AM, Piter_ <x....@gm...> wrote: > Hi all. > Hi all. Can I open matlab figure in matplotlib without conversion in > any other format? > I am 90% sure the answer for my question if not. But I give a 10% lazy > hope that it is possible. No, and there are no plans to support it. We want to provide a fairly easy mental map for people familiar with matlab to use matplotlib, but don't expend any effort on full compatibility, eg running m-files and opening fig files. For that degree of compatibility, there is matlab itself and octave. JDH |
|
From: Piter_ <x....@gm...> - 2012-01-24 12:06:29
|
Hi all. Hi all. Can I open matlab figure in matplotlib without conversion in any other format? I am 90% sure the answer for my question if not. But I give a 10% lazy hope that it is possible. Thanks |
|
From: Gousios G. <gg...@wi...> - 2012-01-24 11:32:07
|
Στις 23/01/2012 08:39 μμ, ο/η Tony Yu έγραψε: > > > 2012/1/23 Gousios George <gg...@wi... > <mailto:gg...@wi...>> > > Στις 23/01/2012 08:10 μμ, ο/η Benjamin Root έγραψε: >> 2012/1/23 Gousios George <gg...@wi... >> <mailto:gg...@wi...>> >> >> Στις 23/01/2012 07:48 μμ, ο/η Tony Yu έγραψε: >>> >>> >>> 2012/1/23 Gousios George <gg...@wi... >>> <mailto:gg...@wi...>> >>> >>> Στις 23/01/2012 06:52 μμ, ο/η Tony Yu έγραψε: >>>> >>>> >>>> 2012/1/23 Gousios George <gg...@wi... >>>> <mailto:gg...@wi...>> >>>> >>>> Στις 21/01/2012 07:43 μμ, ο/η Gousios George έγραψε: >>>>> Στις 21/01/2012 07:05 μμ, ο/η Tony Yu έγραψε: >>>>>> >>>>>> >>>>>> On Sat, Jan 21, 2012 at 11:31 AM, Gousios George >>>>>> <gg...@wi... >>>>>> <mailto:gg...@wi...>> wrote: >>>>>> >>>>>> Στις 21/01/2012 04:54 μμ, ο/η Tony Yu έγραψε: >>>>>>> >>>>>>> >>>>>>> On Sat, Jan 21, 2012 at 9:07 AM, Gousios >>>>>>> George <gg...@wi... >>>>>>> <mailto:gg...@wi...>> wrote: >>>>>>> >>>>>>> Hello , i have the following code in >>>>>>> matlab and trying to do it in >>>>>>> matplotlib. >>>>>>> >>>>>>> I have this code in matlab (in a >>>>>>> function showGraphs): >>>>>>> ... >>>>>>> m = size(myList, 3); >>>>>>> for k = 1:m >>>>>>> g = myList(:, :, k); >>>>>>> image(g + 1) >>>>>>> axis off >>>>>>> axis square >>>>>>> M(k) = getframe; >>>>>>> end; >>>>>>> >>>>>>> and in another file (another function): >>>>>>> ... >>>>>>> M = showGraphs(grids) >>>>>>> movie(M, 1) >>>>>>> >>>>>>> >>>>>>> >>>>>>> I did so far: >>>>>>> >>>>>>> def showGraphs(data): >>>>>>> data=sc.array([data]) >>>>>>> n=sc.shape(data)[2] >>>>>>> for k in range(n): >>>>>>> mydata=data[:,:,k] >>>>>>> #plt.imshow(mydata+1) -->> >>>>>>> this doesn't work >>>>>>> >>>>>>> Also ,in order to do the animation : >>>>>>> >>>>>>> grids=...(result from another function) >>>>>>> result=showGraph(grids) >>>>>>> fig=plt.figure() >>>>>>> ani=animation.FuncAnimation(fig,result,interval=30,blit=True) >>>>>>> plt.show() >>>>>>> >>>>>>> Right now the program says "TypeError: >>>>>>> 'NoneType' object is not >>>>>>> callable" (it has errors in the >>>>>>> animation call) >>>>>>> >>>>>>> What should be my approach to this in >>>>>>> order to have the animation? >>>>>>> >>>>>>> Thank you! >>>>>>> >>>>>>> >>>>>>> You're getting that error because the second >>>>>>> argument to FuncAnimation (`result` in your >>>>>>> example) should be a function (not always; >>>>>>> see example 2 linked below). Right now, if >>>>>>> your `showGraphs` function is defined in >>>>>>> full, it returns a value of None, which gets >>>>>>> saved to `result` (hence the error). >>>>>>> >>>>>>> You should take a look at some of the image >>>>>>> animation examples (ex1 >>>>>>> <http://matplotlib.sourceforge.net/examples/animation/dynamic_image.html>, >>>>>>> ex2 >>>>>>> <http://matplotlib.sourceforge.net/examples/animation/dynamic_image2.html>). >>>>>>> >>>>>>> -Tony >>>>>>> >>>>>> >>>>>> I did now : >>>>>> >>>>>> >>>>>> def showGraphs(data): >>>>>> data=sc.array([data]) >>>>>> n=sc.shape(data)[2] >>>>>> ims=[] >>>>>> >>>>>> for k in range(n): >>>>>> mydata=data[:,:,k] >>>>>> im=plt.imshow(mydata+1) >>>>>> ims.append([im]) >>>>>> return ims >>>>>> >>>>>> and now it gives me "TypeError: Invalid >>>>>> dimensions for image data. >>>>>> >>>>>> >>>>>> Please post short, but executable examples when >>>>>> possible. I'm not sure what your data looks like, >>>>>> but your call to `sc.array` is strange (I'm not >>>>>> sure why you have square brackets, which >>>>>> effectively adds an unnecessary dimension to your >>>>>> data). >>>>>> >>>>>> The code attached below should work. >>>>>> >>>>>> Cheers, >>>>>> -Tony >>>>>> >>>>>> import numpy as np >>>>>> import matplotlib.pyplot as plt >>>>>> from matplotlib.animation import ArtistAnimation >>>>>> >>>>>> >>>>>> fig = plt.figure() >>>>>> >>>>>> def showGraphs(data): >>>>>> data = np.asarray(data) # unnecessary in this >>>>>> example >>>>>> n = np.shape(data)[2] >>>>>> >>>>>> ims = [] >>>>>> #for mydata in np.rollaxis(data, -1): >>>>>> for k in range(n): >>>>>> mydata = data[:, :, k] >>>>>> im = plt.imshow(mydata) >>>>>> ims.append([im]) >>>>>> return ims >>>>>> >>>>>> # 5 frames of a random 20 x 20 image >>>>>> data = np.random.uniform(size=(20, 20, 5)) >>>>>> ims = showGraphs(data) >>>>>> >>>>>> ani = ArtistAnimation(fig, ims) >>>>>> plt.show() >>>>> Now,it gives me 2 figures (why 2?) but >>>>> empty.(maybe i didn't convert right the matlab >>>>> code below?) >>>>> The data in the showGraphs function is the result >>>>> from this function (in matlab): >>>>> ......... >>>>> grids = zeros(n, n, t + 1); >>>>> grids(:, :, 1) = rest; >>>>> for i = 2:(t + 1) >>>>> Extended = extendLat1(rest); >>>>> rest = applyExtended(Extended); >>>>> grids(:, :, i) = rest; >>>>> end; >>>>> >>>>> And i did this in python: >>>>> >>>>> grids=sc.zeros((area,area,t+1)) >>>>> rest=grids[:,:,0] >>>>> for i in range(1,t): >>>>> extended=extend(rest) >>>>> rest=apply_extend(extended) >>>>> grids[:,:,i]=rest >>>>> return grids >>>>> >>>>> Thanks for helping! >>>>> >>>> Any help?Thanks! >>>> >>>> Sorry, but could you be a bit clearer: >>>> * Did the example I provide work for you? >>>> * Assuming it did, are you essentially replacing `data` >>>> in my example with `grids` in this most recent example? >>>> * I don't get 2 figures: are you asking about the code >>>> from my last message? >>>> * Please provide a minimal, *executable* example >>>> >>>> -Tony >>> Ok,i 'll try! >>> >>> 1) Yes,your example works fine. >>> 2) Yes,i return grids from another function (work) doing : >>> >>> grids=work(area,...,time) >>> result=showGraphs(grids) >>> ani=ArtistAnimation(fig,result) >>> plt.show() >>> >>> The contents of the work function are shown above. >>> I just want to make sure that i have done the conversion >>> from matlab right. >>> Maybe the problem is somewhere else? >>> >>> Thank you. >>> >>> >>> Did you get 2 figures with my original example, or just in >>> your modified code? If it's only in your modified code, then >>> there's something you're not showing which is creating the >>> extra figure. >>> >>> Unfortunately, the `work` function you showed in the >>> previous message is not executable (`apply_extend`, >>> `extend`, etc. aren't defined), which it makes it very >>> difficult to debug. If my code snippet worked for you, then >>> the only difference is in how you've defined `grids`---do >>> you know how it's different? >>> >>> -Tony >>> >> Ok,i am sending you the whole code of the program. (forget >> the names of the functions i showed you so far , i use other >> names). >> >> EMPTY=0 #empty cell >> TREE=1 #tree cell >> BURNING=2 #burning cell >> probTree=0.8 #probability of tree >> probBurning=0.001 #a tree ignites with this probability even >> if no neighbor is burning >> probLighting=0.0001 #chance that a tree been hit from light >> probResistBurn=0.3 #chance that a tree does not burn even >> if it's neighbor burns >> t=20 >> area=50 >> >> >> def spread(cell,N,E,S,W): >> >> if cell==EMPTY: >> return EMPTY >> elif cell==BURNING: >> return EMPTY >> else: >> if (N==BURNING or E==BURNING or S==BURNING or >> W==BURNING): >> if (sc.rand()<probResistBurn): >> return TREE >> else: >> return BURNING >> elif (sc.rand()<probLighting *(1-probResistBurn)): >> return BURNING >> else: >> return TREE >> >> def extend(lat): >> lat = sc.matrix(lat) >> extendRows= sc.vstack([lat[-1,:], lat, lat[0,:]]) >> extendLat=sc.hstack([extendRows[:,-1], extendRows, >> extendRows[:,0]]) >> return extendLat >> >> def apply_extend(matr): >> #matr = sc.matrix(matr) >> matr=sc.array([matr]) >> area=sc.shape(matr)[0] >> final=sc.zeros((area,area)) >> for i in range(1,area): >> for j in range(1,area): >> cell=matr[i,j] >> N=matr[i-1,j] >> E=matr[i,j+1] >> S=matr[i+1,j] >> W=matr[i,j-1] >> final[i-1,j-1]=spread(cell,N,E,S,W) >> return final >> >> def >> fire(area,probTree,probBurning,probLighting,probResistBurn,t): >> >> trees_or_burns=sc.rand(area,area)<probTree # tree or a >> burning tree >> burns=trees_or_burns*(sc.rand(area,area)<probBurning) >> # burning tree >> trees=trees_or_burns-burns # >> tree >> empties=sc.ones((area,area))-trees_or_burns # >> empty cell >> >> forest=empties*EMPTY + trees*TREE + burns*BURNING #the >> whole forest >> >> grids=sc.zeros((area,area,t+1)) >> forest=grids[:,:,0] >> for i in range(1,): >> extended_forest=extend(forest) >> forest=apply_extend(extended_forest) >> grids[:,:,i]=forest >> return grids >> >> def Graph(data): >> data=sc.array(data) >> n=sc.shape(data)[2] >> ims=[] >> for i in range(n): >> mydata=data[:,:,i] >> im=plt.imshow(mydata) >> >> ims.append([im]) >> return ims >> >> >> if __name__=="__main__": >> >> grids=fire(area,probTree,probBurning,probLighting,probResistBurn,t) >> result=Graph(grids) >> fig=plt.figure() >> >> #ani=animation.FuncAnimation(fig,result,interval=30,blit=True,repeat_delay=1000) >> ani=ArtistAnimation(fig,result) >> plt.show() >> >> Also, i am sending you the code in matlab : >> >> >> >> In Graph(), you call "plt.imshow()", which will create a new >> figure automatically if one doesn't exist already. Change >> fig=plt.figure() to fig=plt.gcf() >> >> Ben Root >> > Ok,now it shows me only one figure but it's full of blue color and > doesn't do anything. > Thanks > > Actually, it's plotting your data correctly. If you print out the > values of `mydata` in the `Graph` loop, you'll see that everything is > zero. > > -Tony You are right they are all zeros!I don't unsderstand.. I am not sure if the function extend causes the problem. The extend function from matlab is : function extlat = extendLat1(lat); extendRows = [lat(end, :); lat; lat(1, :)]; extlat = [extendRows(:, end) extendRows extendRows(:, 1)]; I tested my version and i am sure that it gives the right results.But here,in matlab it has "lat" as argument . In python i create "lat = sc.matrix(lat)" .I think this is right?? Also , the function apply_extend in matlab is: function newmat = applyExtended(matExt); n = size(matExt, 1) - 2; newmat = zeros(n); for i = 2:(n + 1) for j = 2:(n + 1) site = matExt(i, j); N = matExt(i - 1, j); E = matExt(i, j + 1); S = matExt(i + 1, j); W = matExt(i, j - 1); newmat(i - 1, j - 1) = spread(site, N, E, S, W); end; end; I think i have done it right. Also ,the function fire in matlab : function grids = fire(n, probTree, probBurning, chanceLightning, chanceImmune, t); global EMPTY TREE BURNING probLightning probImmune EMPTY = 0; TREE = 1; BURNING = 2; probLightning = chanceLightning; probImmune = chanceImmune; treesOrBurns = (rand(n) < probTree); burns = treesOrBurns .* (rand(n) < probBurning); trees = treesOrBurns - burns; empties = 1 - treesOrBurns; forest = empties * EMPTY + trees * TREE + burns * BURNING; grids = zeros(n, n, t + 1); grids(:, :, 1) = forest; for i = 2:(t + 1) forestExtended = extendLat1(forest); forest = applyExtended(forestExtended); grids(:, :, i) = forest; end; Could someone figure where am i doing wrong?(i have the whole code of mine above). Thanks! |
|
From: Benjamin R. <ben...@ou...> - 2012-01-24 02:54:47
|
On Monday, January 23, 2012, Álvaro Justen [Turicas] <alv...@gm...> wrote: > Hello, > I'm using version 1.0.1 and I think this code snippet and the images > attached are enough to explain the bug: > https://gist.github.com/1667300 > > Images 'bar-log-bug.png' and 'bar-log-ok.png' must be the same since > it is the same data and same configuration - the bug occurs when we > call set_yscale after calling subplot.bar(). > > If you confirm the bug, I'll create an issue on GitHub. This is a known issue and is not a bug. If you know that you are using log scale for your bar graph, then it is best to simply specify it in the bar() command (log=True, I think). Having bar() work when you call set_yscale() before bar() is merely a convenience. Recommended usage is to tell bar() that you are using log scale so that it can avoid taking the log of zero (or negative). Cheers, Ben Root |
|
From: Álvaro J. [T. <alv...@gm...> - 2012-01-24 01:57:38
|
Hello, I'm using version 1.0.1 and I think this code snippet and the images attached are enough to explain the bug: https://gist.github.com/1667300 Images 'bar-log-bug.png' and 'bar-log-ok.png' must be the same since it is the same data and same configuration - the bug occurs when we call set_yscale after calling subplot.bar(). If you confirm the bug, I'll create an issue on GitHub. Thanks, -- Álvaro Justen "Turicas" http://blog.justen.eng.br http://twitter.com/turicas http://CursoDeArduino.com.br http://github.com/turicas +55 21 9898-0141 |
|
From: Paul I. <piv...@gm...> - 2012-01-23 21:20:05
|
Paul Ivanov, on 2012-01-23 13:07, wrote: > the quick and dirty way to get close to what you want is to add > an alpha value to the lines you're already plotting. Here's a > small example: > > x = np.arange(0,3,.01) > y = np.sin(x**2) > all_x,all_y = [],[] > ax = plt.gca() > for i in range(100): > noisex = np.random.randn(1)*.04 > noisey = (np.random.randn(x.shape[0])*.2)**3 > ax.plot(x+noisex,y+noisey, color='b', alpha=.01) > all_x.append(x+noisex) > all_y.append(y+noisey) > > To get a heat diagram, as was suggested, you can use a 2d > histogram. > > plt.figure() > all_x =np.array(all_x) > all_y = np.array(all_y) > all_x.shape = all_y.shape = -1 > H, yedges, xedges = np.histogram2d(all_y, all_x, bins=100) > extent = [xedges[0], xedges[-1], yedges[-1], yedges[0]] > ax = plt.gca() > plt.hot() > ax.imshow(H, extent=extent, interpolation='nearest') > ax.invert_yaxis() For completeness, attached is what the hexbin version of the same data looks like: plt.hexbin(all_x, all_y) You may want to play with the 'bins' (for histogram2d) and 'griddata' (for hexbin) parameters to get the appropriate level of detail for the amount of data you have. best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: Paul I. <piv...@gm...> - 2012-01-23 21:08:03
|
Hi Russ, Russ Dill, on 2012-01-21 13:30, wrote: > I'm using matplotlib from pylab to generate eye patterns for signal > simulations. My output pretty much looks like this: > > http://www.flickr.com/photos/31208937@N06/6079131690/ > > Its pretty useful as it allows one to quickly see the size of the eye > opening, the maximum/minimum voltage, etc. I'd really like to be able > to create a heat diagram, like these: > > http://www.lecroy.com/images/oscilloscope/series/waveexpert/opening-spread2_lg.jpg > http://www.lecroy.com/images/oscilloscope/series/waveexpert/opening-spread1_lg.jpg > http://www.iec.org/newsletter/august07_2/imgs/bb2_fig_1.gif > http://www.altera.com/devices/fpga/stratix-fpgas/stratix-ii/stratix-ii-gx/images/s2gx-rollout-6g-eye.jpg > > Is there any way within matplotlib to do that right now? the quick and dirty way to get close to what you want is to add an alpha value to the lines you're already plotting. Here's a small example: x = np.arange(0,3,.01) y = np.sin(x**2) all_x,all_y = [],[] ax = plt.gca() for i in range(100): noisex = np.random.randn(1)*.04 noisey = (np.random.randn(x.shape[0])*.2)**3 ax.plot(x+noisex,y+noisey, color='b', alpha=.01) all_x.append(x+noisex) all_y.append(y+noisey) To get a heat diagram, as was suggested, you can use a 2d histogram. plt.figure() all_x =np.array(all_x) all_y = np.array(all_y) all_x.shape = all_y.shape = -1 H, yedges, xedges = np.histogram2d(all_y, all_x, bins=100) extent = [xedges[0], xedges[-1], yedges[-1], yedges[0]] ax = plt.gca() plt.hot() ax.imshow(H, extent=extent, interpolation='nearest') ax.invert_yaxis() I'm attaching the two images for reference best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: Benjamin R. <ben...@ou...> - 2012-01-23 20:35:35
|
On Mon, Jan 23, 2012 at 2:21 PM, Tony Yu <ts...@gm...> wrote: > > > On Mon, Jan 23, 2012 at 2:43 PM, reckoner <rec...@gm...> wrote: > >> Hi, >> >> I am trying to create a sequence of rotated rectangles of various >> sizes/orientations. I have been looking at the following page: >> >> http://matplotlib.sourceforge.net/devel/transformations.html >> >> But I can't find any examples of how to use these transformations and >> then show the resulting figures. I am trying to create a sequence of >> frames for a rectangle tumbling forward. This means I would need to >> daisychain the transformations noted above. >> >> Any help getting started would be greatly appreciated! >> >> > Have you seen the Transformations Tutorial<http://matplotlib.sourceforge.net/users/transforms_tutorial.html>? > It has a number of usage examples. > > Cheers, > -Tony > > Do note that while I think what you want to do is techinically feasible, the Transformation framework is probably not really intended for this purpose and may feel awkward. That being said, I think that this example may be the closest to what you want to do: http://matplotlib.sourceforge.net/users/transforms_tutorial.html#using-offset-transforms-to-create-a-shadow-effect Cheers! Ben Root |
|
From: Benjamin R. <ben...@ou...> - 2012-01-23 20:31:10
|
On Mon, Jan 23, 2012 at 1:46 PM, Ethan Swint <es...@vt...> wrote: > > > On 1/23/2012 1:55 PM, Russ Dill wrote: > > On Mon, Jan 23, 2012 at 11:17 AM, Stan West<sta...@nr...> > wrote: > >>> From: Russ Dill [mailto:rus...@gm...] > >>> Sent: Saturday, January 21, 2012 16:31 > >>> > >>> I'm using matplotlib from pylab to generate eye patterns for signal > >>> simulations. > >> ... > >> > >>> Is there any way within matplotlib to do that right now? > >> One way combines Numpy's histogram2d and matplotlib's imshow, as in the > >> example in the histogram2d docs [1]. The example's x array should > become all > >> of the time samples in your traces, strung together in one dimension; > the y > >> array, the corresponding voltage samples. > >> > > I'll try it out and see what I get, but I don't think it will work so > > well. The problem is that while the data is made up of x/y samples, it > > actually represents a line. The samples should be evenly distributed > > not along the x or y axis, but along the length of the line. I feel > > like I'll need a line drawing algorithm. > > > > (For example, if samples are evenly distributed along the x axis, a 89 > > degree line is highly under-represented, but a 1 degree line is highly > > over-represented. The number of samples should be sqrt(dx^2 + dy^2), > > but with evenly spaced x samples, its just dx. > > I don't know of a way to directly produce the LeCroy heatmap in Python, > so here's my idea for a hack: > *Each sample point you have from the trace represents a point in XY > coordinates. > *Similarly, the plot area is filled with regularly spaced XY coordinates. > *Every trace sample will fall within a square bounding box with four > points. > *Each plot area point gets a membership value, based on distance between > centers of the sample point and the plot area point. > *To construct the heat diagram, sum the membership values of all sample > points for all traces. > *Display it with a contour plot, but without the isovalue lines. > > -Ethan > > matplotlib also has hexbin() if that helps. http://matplotlib.sourceforge.net/api/axes_api.html?highlight=hexbin#matplotlib.axes.Axes.hexbin Ben Root |
|
From: Tony Yu <ts...@gm...> - 2012-01-23 20:21:13
|
On Mon, Jan 23, 2012 at 2:43 PM, reckoner <rec...@gm...> wrote: > Hi, > > I am trying to create a sequence of rotated rectangles of various > sizes/orientations. I have been looking at the following page: > > http://matplotlib.sourceforge.net/devel/transformations.html > > But I can't find any examples of how to use these transformations and > then show the resulting figures. I am trying to create a sequence of > frames for a rectangle tumbling forward. This means I would need to > daisychain the transformations noted above. > > Any help getting started would be greatly appreciated! > > Have you seen the Transformations Tutorial<http://matplotlib.sourceforge.net/users/transforms_tutorial.html>? It has a number of usage examples. Cheers, -Tony |