Re: [Matplotlib-users] ellipsoids
On Mon, Oct 17, 2011 at 10:42 PM, pratik wrote: > Is there a function that can draw an ellipsoid like matlab's ellipsoid > function? > relevant: > > http://stackoverflow.com/questions/2153768/draw-ellipse-and-ellipsoid-in-matlab > > Thanks, > > from matplotlib.patches import Ellipse import matplotlib.pyplot as plt x = 0.5 y = 0.5 a = 4 b = 1 theta = 45.0 ell = Ellipse((x, y), a, b, theta) ax = plt.gca() ax.add_artist(ell) plt.show() There are some additional kwargs to the Ellipse constructor that allows you to control color and such. I hope that helps! Ben Root -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ellipsoids
Is there a function that can draw an ellipsoid like matlab's ellipsoid function? relevant: http://stackoverflow.com/questions/2153768/draw-ellipse-and-ellipsoid-in-matlab Thanks, -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib.rcParams(update) and parallel python
On Mon, Oct 17, 2011 at 2:57 PM, tinux wrote: > > I have around 100 python files, that each create one figure using matplotlib. > Since I want to use all CPU cores, I basically did "for filename in files: > execfile(filename)" using a python script. However, this does not produce > the same output as running each file separately (for instance axes, figure > size are sometime wrong). > I _think_ I narrowed it down to this: In all files I need to do > "matplotlib.rcParams(update)". I guess that this influences the matplotlib > rc parameters and thus somehow values from some figures are used for others. > > So, my question is, how can I do something like > "matplotlib.rcParams(update)" so that it does not influence other scripts > that are run in parallel using 'execfile'? Or, how do I set rc parameters > for one specific script? > > BTW, I tried 'pp' and 'multiprocessing', same problem with both. The problem is that the rc params are module level in matplotlib so in a persistent process like ipython if one script modifies the rc params, subsequent files executed in the same process will be affected. You can restore the rc params to their default state by doing before each call to execfile import matplotlib matplotlib.rc_file_defaults() We face the same issue in the "plot_directive" which we use when building the matplotlib documentation. We define a function "clear_state" in https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/sphinxext/plot_directive.py#L484 which closes all open figures, restore the rc defaults, and the updates the defaults to an rc dictionary of the parameters we want for each run. -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib 1.1.0 Error in triangulation.py
On Mon, Oct 17, 2011 at 6:58 PM, Floyd John wrote: > Hello, > > I have read your instruction for bug reporting but this is fairly simple. > > There is a call to self.get_cpp_triangulation() which exists but there is > also a call to self._get_cpp_triangulation at line 174 to obtain the > neighbours. > > Easy to fix. Thanks for the report. Even easy issues are best reported on the issue tracker so they will be less likely to fall between the cracks, we can tag them and assign developers to them, etc. I've opened https://github.com/matplotlib/matplotlib/issues/535 JDH -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Figure legend for 1.1.0 doesn't properly handle errorbars?
Somehow, Figure.legend flattens the given handle list and this is the cause of the problem. https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/figure.py#L994 Does anyone know why this is necessary? I just filed a pull request to remove this. https://github.com/matplotlib/matplotlib/pull/534/files Meanwhile, you may do from matplotlib.legend import Legend l = Legend(fig, h, l, loc='lower right') fig.legends.append(l) This should be equivalent to fig.legend(h,l,loc='lower right'). Or, if you don't need axes legend, you may do legend(h,l,loc='lower right', bbox_to_anchor=[0,0,1,1], bbox_transform=fig.transFigure) Regards, -JJ On Tue, Oct 18, 2011 at 6:59 AM, Sterling Smith wrote: > Let me first say that I appreciate the work that the developers have put into > matplotlib. You're doing a great job. > > I have filed a bug report at > > https://github.com/matplotlib/matplotlib/issues/533 > > wherein I post the following > > Consider: > > from pylab import * > x = arange(0,1,.01) > y = x**2 > fig = figure(2) > ax = fig.add_subplot(111) > errorbar(x,y,yerr=x/10.,label='$x^2$') > errorbar(x,y**3,yerr=x/10.,label='$x^6$') > legend(loc='upper center') > h,l = ax.get_legend_handles_labels() > fig.legend(h,l,loc='lower right') > > > I am getting the right legend for the axes based legend, but the figure based > legend seems to be using the different parts of the errorbar for subsequent > handles, instead of using them as a group. From what I can tell, this has > appeared since the upgrade to version 1.1.0. > > I am running on Linux, python 2.7, gtkAgg backend. > > Thanks, > Sterling > > > -- > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Matplotlib 1.1.0 Error in triangulation.py
Hello, I have read your instruction for bug reporting but this is fairly simple. There is a call to self.get_cpp_triangulation() which exists but there is also a call to self._get_cpp_triangulation at line 174 to obtain the neighbours. Easy to fix. Regards John -- This email is intended for the addressee(s) named and may contain confidential and/or privileged information. If you are not the intended recipient, please notify the sender and then delete it immediately. Any views expressed in this email are those of the individual sender except where the sender expressly and with authority states them to be the views of the Office of Environment and Heritage, NSW Department of Premier and Cabinet. PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING THIS EMAIL -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Figure legend for 1.1.0 doesn't properly handle errorbars?
Let me first say that I appreciate the work that the developers have put into matplotlib. You're doing a great job. I have filed a bug report at https://github.com/matplotlib/matplotlib/issues/533 wherein I post the following Consider: from pylab import * x = arange(0,1,.01) y = x**2 fig = figure(2) ax = fig.add_subplot(111) errorbar(x,y,yerr=x/10.,label='$x^2$') errorbar(x,y**3,yerr=x/10.,label='$x^6$') legend(loc='upper center') h,l = ax.get_legend_handles_labels() fig.legend(h,l,loc='lower right') I am getting the right legend for the axes based legend, but the figure based legend seems to be using the different parts of the errorbar for subsequent handles, instead of using them as a group. From what I can tell, this has appeared since the upgrade to version 1.1.0. I am running on Linux, python 2.7, gtkAgg backend. Thanks, Sterling -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 17 Oct 2011, Benjamin Root wrote: > I only need the last line printed by that print statement. I want to see > how the parsing failed. Ben, Here are the last 3: Line: C 125 ; WX 273 ; N braceright ; B 55 -68 244 707 ; Line: C 126 ; WX 586 ; N asciitilde ; B 39 219 531 408 ; Line: C 127 ; WX 262 ; N ; B 64 506 246 730 ; I see there's no character in the last line. Isn't that interesting! Rich -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Monday, October 17, 2011, Rich Shepard wrote: > On Mon, 17 Oct 2011, Benjamin Root wrote: > >> On line 166, I want you to put "print 'Line:', line". Then, rerun your >> program and report back what the output of that print statement. > > Ben, > > Sorry I mis-understood your request. > > I redirected the output to a file 'error.log' and it contains 104,777 > lines from the 'print line' command. I can gzip it and send it to you off > the list but it's 5.5M in size. > > When I grep for Underline in error.log it's not found. That seems to be > the unknown keyword. > > How would you like me to proceed? > > Thanks, > > Rich > I only need the last line printed by that print statement. I want to see how the parsing failed. Ben -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 17 Oct 2011, Benjamin Root wrote: > On line 166, I want you to put "print 'Line:', line". Then, rerun your > program and report back what the output of that print statement. Ben, Sorry I mis-understood your request. I redirected the output to a file 'error.log' and it contains 104,777 lines from the 'print line' command. I can gzip it and send it to you off the list but it's 5.5M in size. When I grep for Underline in error.log it's not found. That seems to be the unknown keyword. How would you like me to proceed? Thanks, Rich -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib.rcParams(update) and parallel python
I have around 100 python files, that each create one figure using matplotlib. Since I want to use all CPU cores, I basically did "for filename in files: execfile(filename)" using a python script. However, this does not produce the same output as running each file separately (for instance axes, figure size are sometime wrong). I _think_ I narrowed it down to this: In all files I need to do "matplotlib.rcParams(update)". I guess that this influences the matplotlib rc parameters and thus somehow values from some figures are used for others. So, my question is, how can I do something like "matplotlib.rcParams(update)" so that it does not influence other scripts that are run in parallel using 'execfile'? Or, how do I set rc parameters for one specific script? BTW, I tried 'pp' and 'multiprocessing', same problem with both. Any help is greatly appreciated! Cheers, Martin -- View this message in context: http://old.nabble.com/matplotlib.rcParams%28update%29-and-parallel-python-tp32669484p32669484.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Monday, October 17, 2011, Rich Shepard wrote: > On Mon, 17 Oct 2011, Benjamin Root wrote: > >> In the afm.py file, a before line 167, can you print the value of the >> "line" variable and tell us what it is? > > Ben, > > Here are lines 158-167: > > while 1: > line = fh.readline() > if not line: break > line = line.rstrip() > if line.startswith('EndCharMetrics'): return ascii_d, name_d > vals = line.split(';')[:4] > if len(vals) !=4 : raise RuntimeError('Bad char metrics line: %s' > num = _to_int(vals[0].split()[1]) > wx = _to_float(vals[1].split()[1]) > name = vals[2].split()[1] > > Thanks, > > Rich > Rich, On line 166, I want you to put "print 'Line:', line". Then, rerun your program and report back what the output of that print statement. Ben Root -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 17 Oct 2011, Benjamin Root wrote: > In the afm.py file, a before line 167, can you print the value of the > "line" variable and tell us what it is? Ben, Here are lines 158-167: while 1: line = fh.readline() if not line: break line = line.rstrip() if line.startswith('EndCharMetrics'): return ascii_d, name_d vals = line.split(';')[:4] if len(vals) !=4 : raise RuntimeError('Bad char metrics line: %s' num = _to_int(vals[0].split()[1]) wx = _to_float(vals[1].split()[1]) name = vals[2].split()[1] Thanks, Rich -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, Oct 17, 2011 at 12:57 PM, Rich Shepard wrote: > After a long hiatus I'm again working on an application and just upgraded > matplotlib from 0.98.5.2 to 0.99.1.2. However, there's an error on start up > that I need your help in resolving. > > There are many dozens of lines containing: > > Found an unknown keyword in AFM header (was Underline) > > The traceback (in its entirety) shows: > > Traceback (most recent call last): > File "./eikos.py", line 6, in > from modelPage import modModel > File "/home/rshepard/development/trunk/modelPage.py", line 8, in > from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as > FigureCanvas > File > "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py", > line 20, in > from matplotlib.figure import Figure > File "/usr/lib/python2.6/site-packages/matplotlib/figure.py", line 18, in > > from axes import Axes, SubplotBase, subplot_class_factory > File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 12, in > > import matplotlib.axis as maxis > File "/usr/lib/python2.6/site-packages/matplotlib/axis.py", line 10, in > > import matplotlib.font_manager as font_manager > File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line > 1301, in > _rebuild() > File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line > 1292, in _rebuild > fontManager = FontManager() > File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line > 1010, in __init__ > self.afmlist = createFontList(self.afmfiles, fontext='afm') > File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line > 578, in createFontList > font = afm.AFM(fh) > File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 295, in > __init__ > parse_afm(fh) > File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 283, in > parse_afm > dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh) > File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 167, in > _parse_char_metrics > name = vals[2].split()[1] > IndexError: list index out of range > > Please tell me what I need to do to resolve this error. > > Rich > > Rich, In the afm.py file, a before line 167, can you print the value of the "line" variable and tell us what it is? Ben Root -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 0.99.1.2: error in afm.py
After a long hiatus I'm again working on an application and just upgraded matplotlib from 0.98.5.2 to 0.99.1.2. However, there's an error on start up that I need your help in resolving. There are many dozens of lines containing: Found an unknown keyword in AFM header (was Underline) The traceback (in its entirety) shows: Traceback (most recent call last): File "./eikos.py", line 6, in from modelPage import modModel File "/home/rshepard/development/trunk/modelPage.py", line 8, in from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas File "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py", line 20, in from matplotlib.figure import Figure File "/usr/lib/python2.6/site-packages/matplotlib/figure.py", line 18, in from axes import Axes, SubplotBase, subplot_class_factory File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 12, in import matplotlib.axis as maxis File "/usr/lib/python2.6/site-packages/matplotlib/axis.py", line 10, in import matplotlib.font_manager as font_manager File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1301, in _rebuild() File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1292, in _rebuild fontManager = FontManager() File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1010, in __init__ self.afmlist = createFontList(self.afmfiles, fontext='afm') File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line 578, in createFontList font = afm.AFM(fh) File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 295, in __init__ parse_afm(fh) File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 283, in parse_afm dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh) File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 167, in _parse_char_metrics name = vals[2].split()[1] IndexError: list index out of range Please tell me what I need to do to resolve this error. Rich -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] please help with arrow drawing.
Hi all I want to draw an two headed arrow between two points. But I get a line. What I am doing wrong? I actually try to plot an image similar to this one: http://upload.wikimedia.org/wikipedia/commons/a/a3/Parameters_of_the_Marcus_Equation.JPG may be I can use an annotate function for this. Thanks for help. Petro. import pylab from scipy import optimize import numpy x1=numpy.arange(-4000,1000,0.1) x2=numpy.arange(-1000,4000,0.1) y1=100*numpy.square(x1+1500) y2=100*numpy.square(x2-1500)-0.1e9 pylab.figure() pylab.plot(x1,y1,x2,y2) pylab.grid("True") pylab.arrow(-3000,0,0,-1,width=1) pylab.xlim(-5000,5000) pylab.ylim(-2e8,7e8) pylab.show() ###x -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users