[Matplotlib-users] How to draw following gridlines
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 attachment: PDAf1.jpg-- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib sphinx extension crashes Python
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#174; 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 Matplotlib-users@lists.sourceforge.net 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 -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Overlapping labels in pie charts
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.j.j...@gmail.com 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() attachment: tmpkZslt5.png-- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] permille sign in labels
Hi all, does anybody know how to draw a permille sign in ylabel ? Nils -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] permille sign in labels
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#174; 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 Matplotlib-users@lists.sourceforge.net 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 -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] permille sign in labels
On 24 March 2010 10:05, Nils Wagner nwag...@iam.uni-stuttgart.de 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 -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib figure serialization
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#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib figure serialization
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#174; 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 Matplotlib-users@lists.sourceforge.net 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 -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib figure serialization
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/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Overlapping labels in pie charts
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 rvsj...@gmail.com: 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.j.j...@gmail.com 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() -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to draw following gridlines
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 yogeshkarp...@gmail.com 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#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib figure serialization
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...@stsci.edu 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 -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] (no subject)
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. -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Put many graphs on the same plot.
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. -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib figure serialization
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...@stsci.edu 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
Re: [Matplotlib-users] Put many graphs on the same plot.
On 3/24/2010 12:58 PM, david.kremer...@gmail.com wrote: 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. Just use `plot` again. Or do many lines in one go: http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot Here are some possibilities: http://matplotlib.sourceforge.net/gallery.html hth, Alan Isaac -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Put many graphs on the same plot.
david.kremer...@gmail.com wrote: 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. -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Have you looked at: screenshots http://matplotlib.sourceforge.net/users/screenshots.html and/or examples http://matplotlib.sourceforge.net/examples/index.html ? -- jv -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] (no subject)
On Wed, Mar 24, 2010 at 10:55 AM, david.kremer...@gmail.com wrote: 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. If you're just starting out with matplotlib, spending some time in our gallery is a great place to learn: http://matplotlib.sourceforge.net/gallery.html For your particular need, I'd look at: http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo2.html Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib figure serialization
On Wed, Mar 24, 2010 at 1:37 PM, Chris Barker chris.bar...@noaa.gov wrote: 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, To answer your question, because I can't think of a way to build a web-based user interface to let users make incremental changes to the plot produced by that script. Or some other plot that was generated using a different script. ISTM if I have a defined serialization structure (whether it be in XML, JSON, or a python data structure) I can more easily build a web-based user interface for manipulating that structure. Below is an example figure structured as a python dict and a rendering function. Not sure if this clarifies what I am trying to do ... import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt plot = { 'metadata': { 'description': 'This is a sample plot representation', 'matplotlib_version': '0.99.0', 'author': 'RMK', 'last_updated': [2010, 3, 24, 13, 25, 0], 'type': 'lineplot' }, 'figure': {'methods': [ ['set_size_inches', [10,4], {} ] ] }, 'axes': { 121: {'datasets':[ { 'data': [ [1,2,3], [4,5,6] ], 'options': {'linewidth':4, 'label': 'Source 1'}, }, { 'data': [ [1,2,3], [12,13,14] ], 'options': {'linewidth':4, 'label': 'Source 2', 'marker':'*', 'visible': True}, } ], 'methods': [ ['set_xlabel', [Testing ...], {} ], ['legend', [], {} ] ] }, 122: { 'datasets': [ { 'data': [ [1,2,3], [7,8,9] ], 'options':{'linewidth':4, 'label': 'Source 3'}, } ], 'methods': [ ['set_xlabel', [Label ...], {} ], ['legend', [], {} ] ] } } } def generate(plot,figname): fig = plt.figure() methods = plot['figure']['methods'] for method, args, kwds in methods: getattr(fig, method)(*args, **kwds) for axes in plot['axes']: ax = plt.subplot(axes) datasets = plot['axes'][axes]['datasets'] for dataset in datasets: plt.plot(*(dataset['data']), **(dataset['options'])) for method, args, kwds in plot['axes'][axes]['methods']: getattr(ax, method)(*args, **kwds) plt.savefig(figname) if __name__ == '__main__': generate(plot, 'junk.png') Rich -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] where's superpack?
Hello, I am using macosx 10.6 aka snow leopard (not willingly btw) and I need to install matplotlib. I know of superpack but the site seems to have been dead for some weeks now. Does anybody know where I could get a copy of superpack? thanks, Pau -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] format yticks
Hi all, how can I change the output format of yticks from 100 to 1.e6 ? Nils -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] where's superpack?
David Kremer wrote: Does anybody know where I could get a copy of superpack? I don't know of the status of that, but this is what I recommend: install the python2.6 from python.org install the numpy1.3 binary from scipy.org install the matplotlib binary (*.dmg) from matplotlib.org (optional) install the scipy binary from scipy.org and there you go -- I suppose it would be nice to have it all in one install, but that's not too hard. (if you really want all in one -- check out Python(x,y) or EPD) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [matplotlib install] Problem when compiling.
Hello, I have a problem when compiling matplotlib. python setup.py build stop here : copying lib/matplotlib/mpl-data/matplotlibrc - build/lib.linux- x86_64-2.4/matplotlib/mpl-data copying lib/matplotlib/mpl-data/matplotlib.conf - build/lib.linux- x86_64-2.4/matplotlib/mpl-data running build_ext error: don't know how to compile C/C++ code on platform 'posix' with 'gcc' compiler Any idea? By the way, do you know how to install matplotlib in a selected location ? Thank you very much. David -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib figure serialization
On Wed, Mar 24, 2010 at 4:19 PM, Michael Droettboom md...@stsci.edu wrote: 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...@stsci.edu 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. Here are my reasons why a structured representation (dict, JSON, XML, ...) is useful: - I want to access the same plot representation through both python and through javascript. I need to access it in python to run MPL and create plot images, and I want to use javascript to build the user interface. - I want to separate the plot content from the plot generation. I can serialize a data structure containing plot contents more easily than I can record the commands a user might call to generate a plot. The content of the plot is not python specific, only the generation of the MPL plot is. I need to be able to serialize the content to support later modifications. 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
[Matplotlib-users] Hiring: Software Developer, Scientific Applications
Enthought is hiring a Software Developer. See the description below, or on our website: http://www.enthought.com/company/sd-scientific-app.php Best, Amenity -- Amenity Applewhite Enthought, Inc. Scientific Computing Solutions www.enthought.com Software Developer The Software Developer at Enthought, Inc. participates in the development of scientific and technical applications involving GUIs, 2- D and 3-D graphics, workflow and pipeline architecture, and numerical algorithms. The position also involves some interaction with clients. Some travel may be required. We are interested both in experienced applicants as well as in recent graduates. Applicants should have a BS, MS, or PhD degree with a strong background in science and mathematics, as well as real experience developing quality software, either commercial or open source. More experienced applicants should also have demonstrated project management skills and the ability to lead a team of strong developers with highly technical backgrounds. Applicants will be measured against the following qualifications: • (Required) Bachelor's Degree in Computer Science or other scientific or engineering field with preferably an M.S. or Ph.D. degree. • (Required) Minimum 2 years of technical lead or development experience with 4 or more years preferred. • Ability to understand a problem domain and then conceive of and implement an intuitive user interface geared toward the scientist or engineer user. • Discipline, pride, and professionalism to write readable, documented, and unit-tested code that serves as an example to others who later study your work. • Strong work ethic and commitment to satisfying the customer. • Experience with Python, and a strong understanding of how to apply its capabilities to develop GUI frameworks, work flow frameworks, and elegant scientific applications. • Strong understanding of statistics, optimization, image processing, signal processing, or other technical area. • Experience with the following: • GUI frameworks such as NetBeans or Eclipse • wxPython, Qt • Low-level 2-D graphics APIs such as Quartz or GDI+ • 3-D graphics, preferably using VTK • Developing or working with plotting APIs • Experience using (and interest in contributing to) SciPy • numeric algorithms Enthought offers competitive salaries and the opportunity to work on varied and interesting technical projects. We are located in Austin, TX, consistently rated as one of the best places to live in the US. Benefits include health, dental, vision and a 401k plan. If you are interested in applying, submit a resume to j...@enthought.com. Code samples and links to previous work are encouraged but not required. -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] format yticks
On 24 March 2010 17:33, Nils Wagner nwag...@iam.uni-stuttgart.de wrote: Hi all, how can I change the output format of yticks from 100 to 1.e6 ? I'm not sure if there's an easier way still, but this works: from matplotlib.ticker import Formatter class SciFormatter(Formatter): def __call__(self, x, pos=None): return %0.2e % x ax = plt.gca() ax.yaxis.set_major_formatter(SciFormatter()) plt.draw() Angus. -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Speaking of many ... line collections? (was: Put many graphs...)
At what point is a line Collection useful? -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Bar plot, 0 values
Hi there, While creating bar plots I found that bars with height 0 are not being displayed. Their space is distributed evenly between the other columns. Sample script: /-- from pylab import * import sys figure(8) if(sys.argv[1].lower() == 'y'): bar([0, 1, 0, 0, 0], [0, 1, 0, 0, 0]) else: bar([1, 2, 3, 4, 5], [1, 2, 3, 4, 5]) show() \-- Try it with argument 'y' and without. So far I didn't find a solution. '0' is not an easy thing to google :-) Anyone got an idea? Cheers, B. -- Download Intel#174; 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users