You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
1
(16) |
2
(22) |
3
(28) |
4
(17) |
5
(17) |
6
(7) |
7
|
8
(15) |
9
(28) |
10
(26) |
11
(28) |
12
(19) |
13
(5) |
14
(3) |
15
(21) |
16
(28) |
17
(11) |
18
(18) |
19
(6) |
20
(5) |
21
(18) |
22
(11) |
23
(22) |
24
(28) |
25
(17) |
26
(17) |
27
(7) |
28
(16) |
29
(24) |
30
(25) |
31
(14) |
|
|
|
Rich Krauter wrote: >> Rich Krauter wrote: >> >>> Hello, >>> >>> I am a relatively new user of matplotlib; thank you to the matplotlib team for this excellent package. >>> I have a question about serializing matplotlib figures. I have searched for serialization options for matplotlib figures but have not found much information. I am interested to hear about serialization use cases and the approaches others use in these cases. >>> >>> Here is the reason I am asking: >>> >>> My use case for serialization is that I want to build a CouchDB database of matplotlib figures. The database could be accessed from a web application (in my case I want to build a django app to create, edit and manage figures) or desktop gui, or whatever. For storage of the figures in CouchDB, I am working on JSON representations of matplotlib figures. The JSON could be run through simple python functions to regenerate the matplotlib figures. I have very simple working examples, but to more completely test out this approach I would attempt to recreate the plots in the matplotlib gallery using JSON representations and a small set of (hopefully) very simple python functions which would process the JSON markup. >>> >>> Before I get too far, I wanted to see what others have done for similar use cases, make sure I am not missing existing approaches, etc. I am getting ahead of myself now, but if there is broader interest in this approach, and no other better solutions exist, I would set up a project on Google Code or some other site to work on this. >>> > > On Wed, Mar 24, 2010 at 1:15 PM, Michael Droettboom <md...@st...> wrote: > >> What is the advantage of JSON (is this specific case) over Python source code? matplotlib is designed around it and it's more flexible. Unless you're planning on automatically manipulating the JSON, I don't see why you wouldn't just use Python source. >> >> Mike >> >> > > Mike, > > I don't know that there is much of a benefit to JSON outside of my use > case or similar use cases. I want to manipulate the JSON > representation of a figure within a javascript-based web interface to > provide dynamic plotting through a web page. I also want to be able > to store and query JSON representations using CouchDB. > > I am probably not exactly clear on what you mean by "using python > source" to represent a figure. Is there a standard agreed upon way to > do this? In general, most matplotlib users write Python scripts to generate their plots. These scripts usually read in data from an external file in any number of formats (the format tends to be domain-specific, but matplotlib provides support for a number of CSV formats, Numpy itself supports a number of ways of reading arrays etc.) matplotlib tends to be agnostic about data (as long as you can convert it to a Numpy array somehow, it's happy), but has a clearly defined API for plot types and styles. > I do have python source code representations of figures. > i.e. I have dict representations of matplotlib figures. The dicts > have a "required" internal structure. I feed the dict to a function > which regenerates the figure graphic from that structure. If I want > to update the plot, I just change the contents of the dict data > structure representing the plot, not the source code that is used to > generate the figure. If I instead had a JSON object representation of > a figure, I would convert it to a python dict and use the same > function as before to produce the figure. > I guess I have trouble seeing why a dictionary representation which is then interpreted to convert it to function calls is better than just making the function calls directly. That's the "interface" to matplotlib that is known and tested. The only use case I can imagine where a dictionary might be preferable would be if an external tool needs to read in the dictionary, modify it and spit it back out. Reading arbitrary Python code is of course extremely hairy, whereas the JSON dictionary could be defined to be a more limited and manageable subset. Another possible advantage may be security related -- if you need to run untrusted plot code, you certainly don't want to be running untrusted Python code. > I haven't found much discussion about serialization of matplotlib > figures, but I probably have not searched well enough, or maybe it is > not a high interest topic. The discussion I have found seems to > suggest using the script you used to create the figure as the > serialization of that figure. To modify the figure, you modify the > script an rerun it. Yes -- that's the general consensus (at least among the core developers) when the discussion comes up. There have been discussions and experiments using enthought.Traits that might make plots serializable and malleable, but it's a significant refactoring of matplotlib to take such an approach, for a fairly minor gain. It's also extremely difficult to invent a serialization that would survive version upgrades to matplotlib. One advantage of the script approach is that when APIs change in a backward-incompatible way, it is generally easier for end users to update their plots. If plots were in a less human readable/writable format the changes required may be less obvious. > What I would like to have (and what I have some > very preliminary examples for) are versioned data structures that can > be converted to matplotlib figures without modifying any python source > code (other than the structured representation of the figure itself.) > However, I don't know how much the matplotlib API changes, and an > approach like this may be very sensitive to those changes. > I don't understand the motivation to avoid modifying Python source code. If you want to have common functionality that needs to change en masse, you can use Python functions in a library. You could write Python scripts defining a plot that are nothing more than data and a single function call to said library. Are you indexing the JSON at a fine-grained level in the couchdb, or are they ultimately just blobs anyway? In which case a Python blob or a JSON blob should make no difference. I'm not trying to dissuade you from creating a JSON frontend if there's a strong advantage. But keeping that frontend in sync with the progress of matplotlib may be difficult, depending on how much coverage you want to provide. Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
> Rich Krauter wrote: >> >> Hello, >> >> I am a relatively new user of matplotlib; thank you to the matplotlib team for this excellent package. >> I have a question about serializing matplotlib figures. I have searched for serialization options for matplotlib figures but have not found much information. I am interested to hear about serialization use cases and the approaches others use in these cases. >> >> Here is the reason I am asking: >> >> My use case for serialization is that I want to build a CouchDB database of matplotlib figures. The database could be accessed from a web application (in my case I want to build a django app to create, edit and manage figures) or desktop gui, or whatever. For storage of the figures in CouchDB, I am working on JSON representations of matplotlib figures. The JSON could be run through simple python functions to regenerate the matplotlib figures. I have very simple working examples, but to more completely test out this approach I would attempt to recreate the plots in the matplotlib gallery using JSON representations and a small set of (hopefully) very simple python functions which would process the JSON markup. >> >> Before I get too far, I wanted to see what others have done for similar use cases, make sure I am not missing existing approaches, etc. I am getting ahead of myself now, but if there is broader interest in this approach, and no other better solutions exist, I would set up a project on Google Code or some other site to work on this. On Wed, Mar 24, 2010 at 1:15 PM, Michael Droettboom <md...@st...> wrote: > > What is the advantage of JSON (is this specific case) over Python source code? matplotlib is designed around it and it's more flexible. Unless you're planning on automatically manipulating the JSON, I don't see why you wouldn't just use Python source. > > Mike > Mike, I don't know that there is much of a benefit to JSON outside of my use case or similar use cases. I want to manipulate the JSON representation of a figure within a javascript-based web interface to provide dynamic plotting through a web page. I also want to be able to store and query JSON representations using CouchDB. I am probably not exactly clear on what you mean by "using python source" to represent a figure. Is there a standard agreed upon way to do this? I do have python source code representations of figures. i.e. I have dict representations of matplotlib figures. The dicts have a "required" internal structure. I feed the dict to a function which regenerates the figure graphic from that structure. If I want to update the plot, I just change the contents of the dict data structure representing the plot, not the source code that is used to generate the figure. If I instead had a JSON object representation of a figure, I would convert it to a python dict and use the same function as before to produce the figure. I haven't found much discussion about serialization of matplotlib figures, but I probably have not searched well enough, or maybe it is not a high interest topic. The discussion I have found seems to suggest using the script you used to create the figure as the serialization of that figure. To modify the figure, you modify the script an rerun it. What I would like to have (and what I have some very preliminary examples for) are versioned data structures that can be converted to matplotlib figures without modifying any python source code (other than the structured representation of the figure itself.) However, I don't know how much the matplotlib API changes, and an approach like this may be very sensitive to those changes. Rich
Try something like minorticks_on() grid(True, color="k", ls="solid") grid(True, which="minor", color="r") -JJ On Wed, Mar 24, 2010 at 7:33 AM, yogesh karpate <yog...@gm...> wrote: > Kindly find the image attached with this mail. I want to make the graph > with grid lines(shown in background) as plotted in attached mail(Dont > consider the curve in foreground).How can we do it in matplotlib? I tried > grid(color='#f52887', linestyle='-', linewidth=1). But I couldnt figure out > how to go ahead. > Thanks in advance! > Regards > Yogesh > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
You should not use "angle" style if you change the x,y position (this is due to the algorithm of how the line connecting two points are create). Try something like below instead. if foo: if theta - foo < 10: print >>sys.stderr, "Overlapping, offsetting a little bit" y1 = y1 + 0.1 if x1 > 0 : cstyle="arc,angleA=180,armA=30,armB=10,angleB=%f"%(-theta,) else: cstyle="arc,angleA=0,armA=30,armB=10,angleB=%f"%(theta,) There is not much documentation of how each algorithm works (it is beyond my english skill). They are loosely based on the latex pstrick package and the screenshot in the following link may be useful to get some idea though. http://matplotlib.sourceforge.net/users/annotations_guide.html#annotating-with-arrow Regards, -JJ 2010年3月24日 Rune V. Sjøen <rv...@gm...>: > Hello again, and thank you very much for the answer, suddenly it all got > much clearer to me. The only 'issue' I am having is (from screenshot) what > happens to the line pointing to Logs when I try to offset it a little bit on > the Y axis. It looks like either the angleA or angleB is wrong, but I don't > see and reason why it would be as the X coordinates does not change. > > Another thing I do not quite understand is what that patchB does. > > figure(1, figsize=(6,6)) > ax = axes([0.1, 0.1, 0.8, 0.8]) > > labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' > fracs = [45, 135 ,1, 1] > > p = pie(fracs) > > foo = None > for p1, l1 in zip(p[0], labels): > > r = p1.r > dr = r*0.1 > t1, t2 = p1.theta1, p1.theta2 > theta = (t1+t2)/2. > > xc = cos(theta/180.*pi)*r > yc = sin(theta/180.*pi)*r > x1 = cos(theta/180.*pi)*(r+dr) > y1 = sin(theta/180.*pi)*(r+dr) > > if x1 > 0 : > x1 = r+2*dr > ha, va = "left", "center" > cstyle="angle,angleA=180,angleB=%f"%(-theta,) > print >> sys.stderr, ha, ",A,", va > else: > x1 = -(r+2*dr) > ha, va = "right", "center" > cstyle="angle,angleA=0,angleB=%f"%(theta,) > print >> sys.stderr, ha, ",B,", va > > if foo: > if theta - foo < 10: > print >>sys.stderr, "Overlapping, offsetting a little > bit" > y1 = y1 + 0.1 > foo = theta > > annotate(l1, > (xc, yc), xycoords="data", > xytext=(x1, y1), textcoords="data", ha=ha, va=va, > arrowprops=dict(arrowstyle="-", > connectionstyle=cstyle, > patchB=p1)) > > - Rune > > 2010年3月23日 Jae-Joon Lee <lee...@gm...> >> >> This should be doable using the annotation. Here is a simple cook-up I >> just did. it uses a naive algorithm to place the labels, but I guess >> it gives you an idea how things work. >> a screenshot is attached. >> >> Regards, >> >> -JJ >> >> >> from pylab import * >> >> # make a square figure and axes >> figure(1, figsize=(6,6)) >> ax = axes([0.1, 0.1, 0.8, 0.8]) >> >> labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' >> fracs = [15,30,45, 10] >> >> explode=(0, 0.05, 0, 0) >> p = pie(fracs, explode=explode, shadow=True) >> title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5}) >> >> for p1, l1 in zip(p[0], labels): >> r = p1.r >> dr = r*0.1 >> t1, t2 = p1.theta1, p1.theta2 >> theta = (t1+t2)/2. >> >> xc, yc = r/2.*cos(theta/180.*pi), r/2.*sin(theta/180.*pi) >> x1, y1 = (r+dr)*cos(theta/180.*pi), (r+dr)*sin(theta/180.*pi) >> if x1 > 0 : >> x1 = r+2*dr >> ha, va = "left", "center" >> tt = -180 >> cstyle="angle,angleA=0,angleB=%f"%(theta,) >> else: >> x1 = -(r+2*dr) >> ha, va = "right", "center" >> tt = 0 >> cstyle="angle,angleA=0,angleB=%f"%(theta,) >> >> annotate(l1, >> (xc, yc), xycoords="data", >> xytext=(x1, y1), textcoords="data", ha=ha, va=va, >> arrowprops=dict(arrowstyle="-", >> connectionstyle=cstyle, >> patchB=p1)) >> >> show() > >
Michael Droettboom wrote: > What is the advantage of JSON (is this specific case) over Python source > code? matplotlib is designed around it and it's more flexible. Unless > you're planning on automatically manipulating the JSON, I don't see why > you wouldn't just use Python source. Indeed. There have been a few threads about this topic, and I think the consensus is that the way to auto-generate figures is with python. I don't think that there is any technical reason that one couldn't create a serialized version of an MPL figure in XML, or JSON, (or, for that matter, a python data structure), but it would be a fair bit of effort to write the code, and I don't think you'd get any real advantage over just using scripts -- you need a python script to create a figure in the first place, why not serialize that? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...
What is the advantage of JSON (is this specific case) over Python source code? matplotlib is designed around it and it's more flexible. Unless you're planning on automatically manipulating the JSON, I don't see why you wouldn't just use Python source. Mike Rich Krauter wrote: > Hello, > > I am a relatively new user of matplotlib; thank you to the matplotlib > team for this excellent package. > > I have a question about serializing matplotlib figures. I have > searched for serialization options for matplotlib figures but have not > found much information. I am interested to hear about serialization > use cases and the approaches others use in these cases. > > Here is the reason I am asking: > > My use case for serialization is that I want to build a CouchDB > database of matplotlib figures. The database could be accessed from a > web application (in my case I want to build a django app to create, > edit and manage figures) or desktop gui, or whatever. For storage of > the figures in CouchDB, I am working on JSON representations of > matplotlib figures. The JSON could be run through simple python > functions to regenerate the matplotlib figures. I have very simple > working examples, but to more completely test out this approach I > would attempt to recreate the plots in the matplotlib gallery using > JSON representations and a small set of (hopefully) very simple python > functions which would process the JSON markup. > > Before I get too far, I wanted to see what others have done for > similar use cases, make sure I am not missing existing approaches, > etc. I am getting ahead of myself now, but if there is broader > interest in this approach, and no other better solutions exist, I > would set up a project on Google Code or some other site to work on > this. > > Your feedback is very much appreciated. > > Thanks! > > Rich > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Hello. I would like to know, please, how you can add graphics on a same plot. eg : superpose sine and cosine graphs on the same plot. Thank you very much.
Hello. I would like to know, please, how you can add graphics on a same plot. eg : superpose sine and cosine graphs on the same plot. Thank you very much.
Hello, I am a relatively new user of matplotlib; thank you to the matplotlib team for this excellent package. I have a question about serializing matplotlib figures. I have searched for serialization options for matplotlib figures but have not found much information. I am interested to hear about serialization use cases and the approaches others use in these cases. Here is the reason I am asking: My use case for serialization is that I want to build a CouchDB database of matplotlib figures. The database could be accessed from a web application (in my case I want to build a django app to create, edit and manage figures) or desktop gui, or whatever. For storage of the figures in CouchDB, I am working on JSON representations of matplotlib figures. The JSON could be run through simple python functions to regenerate the matplotlib figures. I have very simple working examples, but to more completely test out this approach I would attempt to recreate the plots in the matplotlib gallery using JSON representations and a small set of (hopefully) very simple python functions which would process the JSON markup. Before I get too far, I wanted to see what others have done for similar use cases, make sure I am not missing existing approaches, etc. I am getting ahead of myself now, but if there is broader interest in this approach, and no other better solutions exist, I would set up a project on Google Code or some other site to work on this. Your feedback is very much appreciated. Thanks! Rich
On 24 March 2010 10:05, Nils Wagner <nw...@ia...> wrote: > Hi all, > > does anybody know how to draw a permille sign in ylabel ? ax.set_ylabel(u'blah \u2030') -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh
You can use Unicode. ylabel(u'\u2030') http://www.unicode.org/charts/charindex.html Mike Nils Wagner wrote: > Hi all, > > does anybody know how to draw a permille sign in ylabel ? > > > Nils > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Hi all, does anybody know how to draw a permille sign in ylabel ? Nils
Anyway you can get a traceback in a debugger? (I'm not a regular Windows user). It's hard to guess what could be going wrong without any further clues. Mike Fredrik Johansson wrote: > Hi, > > I'm having trouble getting the sphinx matplotlib extensions to work. > After adding "'matplotlib.sphinxext.plot_directive'" to the extension > list for my documentation project, when running the sphinx build > script, Python immediately crashes ("python.exe has encountered a > problem and needs to close. We are sorry for the inconvenience...."). > > I assume it's a matplotlib C extension issue (because I don't see why > sphinx would crash the interpreter). > > I'm using 32-bit Windows XP, matplotlib 0.99.1 and sphinx 0.6.5. I've > tried both Python 2.5 and 2.6 with the same result. > > Importing matplotlib and plotting works just fine. > > Fredrik > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Well I realized my error with the extra window being caused by the TopLevel() command. I switched this to Tk.Tk() and it works nicely. However I still have to pack the frame instead of using grid. I can work around this but I wonder if there isn't something else I'm missing. On Tue, Mar 23, 2010 at 6:00 PM, Jonno <jon...@gm...> wrote: > I've been trying to modify the embedding_in_tk.py example to use the > grid manager instead of pack. I can get the plot to show ok but I > can't seem to get the toolbar to show correctly. The following code > does get the toolbar on there but it does use pack for the frame and > also I always end up with an extra blank window (this code is > simplified from something that a Bonnie Douglas posted on this list > recently). > > Any suggestions? > > #!/usr/bin/env python > > import matplotlib > matplotlib.use('TkAgg') > > import Tkinter as Tk > from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, > NavigationToolbar2TkAgg > from matplotlib.figure import Figure > from numpy import arange, sin, pi > > # create toplevel window > tl=Tk.Toplevel() > tl.title("storage") > > # create frame > frame=Tk.Frame(master=tl) > > fig=Figure(figsize=(12,6), dpi=100) > > # create plots > a1 = fig.add_subplot(111) > t = arange(0.0,3.0,0.01) > s = sin(2*pi*t) > a1.plot(t,s) > > # create canvas > canvas=FigureCanvasTkAgg(figure=fig, master=frame) > canvas.show() > > c=canvas.get_tk_widget() > c.grid(row=0, column=0) > > # problems with toolbar not showing solved by setting the master to > # the toplevel window, not the frame!!! > toolbar=NavigationToolbar2TkAgg(canvas, tl) > toolbar.update() > > frame.pack() > > Tk.mainloop() >
On 3/23/10 5:33 PM, Reckoner wrote: > Is it possible to draw a streamlines plot as shown in the following: > > http://www.pyngl.ucar.edu/Examples/Images/ngl04p.0.png > > using matplotlib or basemap? > > Thanks in advance! > > > Sorry, no. -Jeff
Is it possible to draw a streamlines plot as shown in the following: http://www.pyngl.ucar.edu/Examples/Images/ngl04p.0.png using matplotlib or basemap? Thanks in advance!
I've been trying to modify the embedding_in_tk.py example to use the grid manager instead of pack. I can get the plot to show ok but I can't seem to get the toolbar to show correctly. The following code does get the toolbar on there but it does use pack for the frame and also I always end up with an extra blank window (this code is simplified from something that a Bonnie Douglas posted on this list recently). Any suggestions? #!/usr/bin/env python import matplotlib matplotlib.use('TkAgg') import Tkinter as Tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib.figure import Figure from numpy import arange, sin, pi # create toplevel window tl=Tk.Toplevel() tl.title("storage") # create frame frame=Tk.Frame(master=tl) fig=Figure(figsize=(12,6), dpi=100) # create plots a1 = fig.add_subplot(111) t = arange(0.0,3.0,0.01) s = sin(2*pi*t) a1.plot(t,s) # create canvas canvas=FigureCanvasTkAgg(figure=fig, master=frame) canvas.show() c=canvas.get_tk_widget() c.grid(row=0, column=0) # problems with toolbar not showing solved by setting the master to # the toplevel window, not the frame!!! toolbar=NavigationToolbar2TkAgg(canvas, tl) toolbar.update() frame.pack() Tk.mainloop()
> > 2010年3月22日 Friedrich Romstedt <fri...@gm...>: >> I'm not shure whether the following suggestion solves your problem, >> but it would simplify your script anyway. >> >> import matplotlib >> ... >> setup(..., data_files = matplotlib.get_py2exe_datafiles()) >> >> And maybe don't forget to exclude 'libgdk_pixbuf-2.0-0.dll' (on my >> system) in 'dll_excludes'. But I actually don't remember for what >> reason I had to exclude it. >> >> hth, >> Friedrich >> > Hello, I wrote the solution implemented in the hope that it serves at someone else. The Situation ========= I wrote a script using basemap and matplolib. which draw a map.Dread a file containing a bunch of Genbank accession numbers, and downloaded the Genbank records: .... from pylab import * import os, sys import os.path from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties map = Basemap(projection='cyl', resolution='l') map.drawcoastlines() map.drawmapboundary() ... This worked fine as a script, but when I attempted to turn it into a Windows executable with py2exe and the setup.py script: """ from distutils.core import setup import py2exe from distutils.core import setup import py2exe import glob import matplotlib opts = { 'py2exe': { "includes" : ["sip", "PyQt4", "matplotlib.backends", "matplotlib.backends.backend_qt4agg", "matplotlib.figure","pylab", "numpy", "matplotlib.numerix.fft","mpl_toolkits.basemap", "matplotlib.numerix.linear_algebra", "matplotlib.numerix.random_array", "matplotlib.backends.backend_tkagg"], # 'excludes': ['_gtkagg', '_tkagg','_agg2','_cairo', '_cocoaagg', '_fltkagg', '_gtk', '_gtkcairo', ], 'dll_excludes': ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll'] } } data_files = [(r'mpl-data', glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\*.*')), # Because matplotlibrc does not have an extension, glob does not find it (at least I think that's why) # So add it manually here: (r'mpl-data', [r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\matplotlibrc']), (r'mpl-data\images',glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\images\*.*')), (r'mpl-data\fonts',glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\fonts\*.*'))] setup(windows=[{"script" : "myapp.py", "icon_resources": [(1, "myapp.ico")]}, ], version = "1.0", options=opts, data_files=data_files) with the command python setup.py py2exe, attempting to run the resulting myapp.exe would throw an error. The Error ======== This is the error thrown on running the executable: Traceback (most recent call last) File "myapp.py", line 40, in <module> File "mpl_toolkits\basemap\__init__.pyc", line 774, in __init__ File "mpl_toolkits\basemap\__init__.pyc", line 848, in _readboundarydata IOError: Unable to open boundary dataset file. Only the 'crude', 'low', 'intermediate' and 'high' resolution datasets are installed by default. If you are requesting a 'full' resolution dataset, you may need to download and install those files separately (see the basemap README for details). The Problem ========== Location of basemap data The problem is identified when basemap is imported, the code of basemap/__init__.py try to establish the basemap data directory in the library.zip file. [install dir]\dist\library.zip\mpl_toolkits\basemap\data Under normal script-like execution, it works, the path is a string indicating a location accessible through the filesystem . However with py2exe, the location of data basemap directory is located within the shared zip archive that py2exe creates and the above error is thrown. The Solution ========== The solution came in three times 1. Add mpl_toolkits.basemap in the option list (setup.py) #-------------------------------------------- opts = { 'py2exe': { "includes" : ["sip", "PyQt4", "matplotlib.backends", "matplotlib.backends.backend_qt4agg", "matplotlib.figure","pylab", "numpy", "matplotlib.numerix.fft","mpl_toolkits.basemap", "matplotlib.numerix.linear_algebra", "matplotlib.numerix.random_array", "matplotlib.backends.backend_tkagg"], #-------------------------------------------- 2. Add basemap\data in data_files list #-------------------------------------------- data_files = [(r'mpl-data', glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\*.*')), (r'mpl-data', [r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\matplotlibrc']), (r'mpl-data\images',glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\images\*.*')), (r'mpl-data\data',glob.glob(r'C:\Python25\Lib\site-packages\mpl_toolkits\basemap\data\*.*')), #--------------------------------------------- 3. Modification of C:\Python25\Lib\site-packages\mpl_toolkits\basemap\__init__.py Near l.50, add the block "check if it turns into a Windows executable with py2exe" if 'BASEMAPDATA' in os.environ: basemap_datadir = os.environ['BASEMAPDATA'] if not os.path.isdir(basemap_datadir): raise RuntimeError('Path in environment BASEMAPDATA not a directory') else: basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data']) #----------------------------------------------- # Check if it turns into a Windows executable with py2exe import re if (basemap_datadir.find("library.zip") > -1): basemap_datadir=re.sub("library.zip","",basemap_datadir) basemap_datadir=re.sub("mpl_toolkits","mpl-data",basemap_datadir) basemap_datadir=re.sub("basemap","",basemap_datadir) #----------------------------------------------- This works under normal script execution and in py2exe mode.
Hi, I'm having trouble getting the sphinx matplotlib extensions to work. After adding "'matplotlib.sphinxext.plot_directive'" to the extension list for my documentation project, when running the sphinx build script, Python immediately crashes ("python.exe has encountered a problem and needs to close. We are sorry for the inconvenience...."). I assume it's a matplotlib C extension issue (because I don't see why sphinx would crash the interpreter). I'm using 32-bit Windows XP, matplotlib 0.99.1 and sphinx 0.6.5. I've tried both Python 2.5 and 2.6 with the same result. Importing matplotlib and plotting works just fine. Fredrik
On Tue, Mar 23, 2010 at 09:58:11AM -0700, Christopher Barker wrote: > You also might try a different back-end. I'm not sure what EPD sets as > the default but there are sometimes odd Tk issues. EPD should support > wxPython (wxAgg), and maybe the macosx back-end. I believe EPD's default is wxAgg.
Yagua Rovi wrote: > I identify the problem. > There is no basemap data directory and the app search those datas in > [MY_DIR]\dist\library.zip\mpl_toolkits\basemap\data > > But I don't know how to add it at the compilation.... You can add those to "data_files", or you may need to copy them with a little custom code at the end of your setup.py file. -CHB > > > 2010年3月22日 Friedrich Romstedt <fri...@gm...>: >> I'm not shure whether the following suggestion solves your problem, >> but it would simplify your script anyway. >> >> import matplotlib >> ... >> setup(..., data_files = matplotlib.get_py2exe_datafiles()) >> >> And maybe don't forget to exclude 'libgdk_pixbuf-2.0-0.dll' (on my >> system) in 'dll_excludes'. But I actually don't remember for what >> reason I had to exclude it. >> >> hth, >> Friedrich >> > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...
>> I am using the enthought distribution, I would hope that it was done >> right but maybe not. Then it may be an EPD bug, you might as on the EPD list. > As a possible temporary "fix", when I had this problem, I was able to > copy and paste the name of a file into the OSX save box from another > window/terminal etc, and so could still make new names for the files. You also might try a different back-end. I'm not sure what EPD sets as the default but there are sometimes odd Tk issues. EPD should support wxPython (wxAgg), and maybe the macosx back-end. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...
David Carmean wrote: > How was the name Axes chosen for the Axes component? :) Much of the MPL API was modeled after the Matlab API, so you may have to ask Mathworks. However: an "axis" is a single thing -- "the x axis". "axes" is the plural of axis, so when you have a thing with both an x and y axis, is is an "axes". -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...
This should be doable using the annotation. Here is a simple cook-up I just did. it uses a naive algorithm to place the labels, but I guess it gives you an idea how things work. a screenshot is attached. Regards, -JJ from pylab import * # make a square figure and axes figure(1, figsize=(6,6)) ax = axes([0.1, 0.1, 0.8, 0.8]) labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' fracs = [15,30,45, 10] explode=(0, 0.05, 0, 0) p = pie(fracs, explode=explode, shadow=True) title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5}) for p1, l1 in zip(p[0], labels): r = p1.r dr = r*0.1 t1, t2 = p1.theta1, p1.theta2 theta = (t1+t2)/2. xc, yc = r/2.*cos(theta/180.*pi), r/2.*sin(theta/180.*pi) x1, y1 = (r+dr)*cos(theta/180.*pi), (r+dr)*sin(theta/180.*pi) if x1 > 0 : x1 = r+2*dr ha, va = "left", "center" tt = -180 cstyle="angle,angleA=0,angleB=%f"%(theta,) else: x1 = -(r+2*dr) ha, va = "right", "center" tt = 0 cstyle="angle,angleA=0,angleB=%f"%(theta,) annotate(l1, (xc, yc), xycoords="data", xytext=(x1, y1), textcoords="data", ha=ha, va=va, arrowprops=dict(arrowstyle="-", connectionstyle=cstyle, patchB=p1)) show()
Yes, that makes it work. Thank you JJ. On Tue, Mar 23, 2010 at 10:58 AM, Jae-Joon Lee <lee...@gm...> wrote: > In the current implementation, sharing the axis does not mean sharing its > scale. > This is not a subplots-specific issue, but applies to all kind of axes > sharing. > > So you need to change the scale of all the axes even though they have > shared axis. > What seems to be a better approach to me is to initialize "subplots" > with proper scale. > > f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, sharey=True, > subplot_kw=dict(yscale="log")) > > Regards, > > -JJ > > > On Mon, Mar 22, 2010 at 1:18 PM, Gökhan Sever <gok...@gm...> > wrote: > > Hello, > > > > I am testing the newly added subplots function in ipython -pylab with the > > following code: > > > > f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, sharey=True) > > ax1.plot(np.random.random(20)) > > ax2.plot(np.random.random(20)) > > ax3.plot(np.random.random(20)) > > ax4.plot(np.random.random(20)) > > > > For some reason scaling the y-axes logaritmically works only on the > focused > > figure canvas, the rest of the subplots are scaled in a distorted > fashion. > > Axes labels change to proper notation but the scaling stays as if linear > > along with the data. See for better description: > > http://img408.imageshack.us/img408/7149/logscale.png > > > > Any ideas? > > > > -- > > Gökhan > > > > > ------------------------------------------------------------------------------ > > Download Intel® Parallel Studio Eval > > Try the new software tools for yourself. Speed compiling, find bugs > > proactively, and fine-tune applications for parallel performance. > > See why Intel Parallel Studio got high marks during beta. > > http://p.sf.net/sfu/intel-sw-dev > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > -- Gökhan