Re: [matplotlib-devel] Font installation stuff
Michael Droettboom wrote: > My suspicion from looking at the code was that a great deal of time was spent statting all the font files at start up. FontManager.__init__ goes through all the files in the cache to determine if they still exist and refreshes the cache if it finds one missing. Your patch (if I understand pickling correctly) is bypassing all those checks, which I think is generally a good thing. > > However, now findfont has the potential to return a path to a file that no longer exists. findfont should probably be wrapped in a function that will check the result, and if the path doesn't exist, rebuild the cache and then perform the query again. Done and committed. Eric > Cheers, > Mike - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] patch: step function plotting
Hi, I have created a patch against latest svn that adds a function step to the axes class to plot step-functions ;-) It's really simple but nice ... Any interest in adding this? Manuel <>Index: axes.py === --- axes.py (revision 3709) +++ axes.py (working copy) @@ -4995,6 +4995,18 @@ steps=[1, 2, 5, 10], integer=True)) return im + +def step(self, x, y, *args, **kwargs): +x2 = npy.zeros((2*len(x)), npy.float32) +y2 = npy.zeros((2*len(x)), npy.float32) + +x2[0::2] = x +x2[1::2] = x + +y2[1::2] = y +y2[2::2] = y[:-1] + +self.plot(x2, y2, *args, **kwargs) class SubplotBase: """ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Mathtext improvements (merging into trunk)
On Thu, Aug 02, 2007 at 10:31:04AM -0400, Michael Droettboom wrote: > I don't know if we ever reached consensus on how to specify math text > vs. regular text. I agree with Eric that it's down to two options: > using a new kw argument (probably format="math" to be most future-proof) > or Math('string'). I don't think I have enough "historical perspective" > to really make the call but I do have a concern about the second option > that it may be confusing depending on how "Math" is imported. (It may > have to be pylab.Math in some instances but not in others.) But I don't > have a strong objection. > > Any last objections to going with the new keyword argument? I'm guessing that this discussion is already closed, but I would still like to propose another option, just like the original: specify the format in the string itself by requiring a leading '$'. For example: text(x, y, r'$\sin(x)$') or for those functions not starting with math: text(x, y, r'$$phase $[0,2\pi)$') This is a variant on Math(r'$\sin(x)$') which is a bit more compact. As has been pointed out elsewhere, whether or not the string contains tex markup is a property of the string, not a property of the function that use the string. Note that the format keyword will be required for all functions which have string inputs, and may cause problems if there are multiple string inputs to the function. legend() in particular may be a problem. - Paul - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] patch: step function plotting
Manuel, We do plots like this all the time. One thing we've found that's nice to have is a keyword that controls when the increase in y happens. We use a step style keyword that can be 'pre' (go up then right), 'post' (go right then up), and 'mid' (right 0.5, up, right 0.5). Regarding your patch, you might want to check other areas in MPL for data processing examples. I could be wrong but I'm not sure you can assume that incoming data is a float. Some of the unit conversion examples or the line collection code might have better examples. Ted At 07:59 AM 8/14/2007, Manuel Metz wrote: Hi, I have created a patch against latest svn that adds a function step to the axes class to plot step-functions ;-) It's really simple but nice ... Any interest in adding this? Manuel Index: axes.py === --- axes.py (revision 3709) +++ axes.py (working copy) @@ -4995,6 +4995,18 @@ steps=[1, 2, 5, 10], integer=True)) return im + +def step(self, x, y, *args, **kwargs): +x2 = npy.zeros((2*len(x)), npy.float32) +y2 = npy.zeros((2*len(x)), npy.float32) + +x2[0::2] = x +x2[1::2] = x + +y2[1::2] = y +y2[2::2] = y[:-1] + +self.plot(x2, y2, *args, **kwargs) class SubplotBase: """ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] patch: step function plotting
Ted Drain wrote: > Manuel, > We do plots like this all the time. One thing we've found that's nice > to have is a keyword that controls when the increase in y happens. We > use a step style keyword that can be 'pre' (go up then right), 'post' > (go right then up), and 'mid' (right 0.5, up, right 0.5). Good idea. > > Regarding your patch, you might want to check other areas in MPL for > data processing examples. I could be wrong but I'm not sure you can > assume that incoming data is a float. Some of the unit conversion > examples or the line collection code might have better examples. Incoming data can be any numeric type, but it ends up getting converted to the default float type (not float32) internally. Whenever possible, it is good to support masked array input. Eric > > Ted > > At 07:59 AM 8/14/2007, Manuel Metz wrote: >> Hi, >> >> I have created a patch against latest svn that adds a function step to >> the axes class to plot step-functions ;-) It's really simple but nice >> ... Any interest in adding this? >> >> Manuel >> >> >> >> >> Index: axes.py >> === >> --- axes.py (revision 3709) >> +++ axes.py (working copy) >> @@ -4995,6 +4995,18 @@ >> steps=[1, 2, 5, 10], >> integer=True)) >> return im >> + >> +def step(self, x, y, *args, **kwargs): >> +x2 = npy.zeros((2*len(x)), npy.float32) >> +y2 = npy.zeros((2*len(x)), npy.float32) >> + >> +x2[0::2] = x >> +x2[1::2] = x >> + >> +y2[1::2] = y >> +y2[2::2] = y[:-1] >> + >> +self.plot(x2, y2, *args, **kwargs) >> >> class SubplotBase: >> """ >> >> - >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> ___ >> Matplotlib-devel mailing list >> Matplotlib-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > > > > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] patch: step function plotting
At 10:36 AM 8/14/2007, Eric Firing wrote: Ted Drain wrote: Manuel, We do plots like this all the time. One thing we've found that's nice to have is a keyword that controls when the increase in y happens. We use a step style keyword that can be 'pre' (go up then right), 'post' (go right then up), and 'mid' (right 0.5, up, right 0.5). Good idea. Regarding your patch, you might want to check other areas in MPL for data processing examples. I could be wrong but I'm not sure you can assume that incoming data is a float. Some of the unit conversion examples or the line collection code might have better examples. Incoming data can be any numeric type, but it ends up getting converted to the default float type (not float32) internally. Whenever possible, it is good to support masked array input. Agreed - but the way the patch was written, I don't think it will support anything but float (especially not the unit types). Eric Ted At 07:59 AM 8/14/2007, Manuel Metz wrote: Hi, I have created a patch against latest svn that adds a function step to the axes class to plot step-functions ;-) It's really simple but nice ... Any interest in adding this? Manuel Index: axes.py === --- axes.py (revision 3709) +++ axes.py (working copy) @@ -4995,6 +4995,18 @@ steps=[1, 2, 5, 10], integer=True)) return im + +def step(self, x, y, *args, **kwargs): +x2 = npy.zeros((2*len(x)), npy.float32) +y2 = npy.zeros((2*len(x)), npy.float32) + +x2[0::2] = x +x2[1::2] = x + +y2[1::2] = y +y2[2::2] = y[:-1] + +self.plot(x2, y2, *args, **kwargs) class SubplotBase: """ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
> Done and committed. It seems a recent commit has severely broken my font loading. When I start MPL now, I get an infinite stream of messages similar to: Found an unknown keyword in AFM header (was ) Found an unknown keyword in AFM header (was !"% #*3*9*:*<[EMAIL PROTECTED]@";;"C#C)*=>A&B879(') **7'6'7#5#3#327#"'#5##53&'#7/75&'7535#35#35#'3'#' ) Found an unknown keyword in AFM header (was ?)52 Je) !_)nd an unknown keyword in AFM header (wasSS.,?+%"5??0 Found an unknown keyword in AFM header (was g Perhaps this is related to the recent commit? -r Rob Hetland, Associate Professor Dept. of Oceanography, Texas A&M University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
Hmm... I'm not readily able to reproduce this here. What are you setting in matplotlibrc (or in your plot?) Also, if you delete the font cache (which is now ~/.matplotlib/fontManager.cache), does that help? (Might be a useful data point -- not suggesting it as a solution.) Cheers, Mike Rob Hetland wrote: >> Done and committed. > > It seems a recent commit has severely broken my font loading. When I > start MPL now, I get an infinite stream of messages similar to: > > Found an unknown keyword in AFM header (was ) > Found an unknown keyword in AFM header (was !"% > #*3*9*:*<[EMAIL PROTECTED]@";;"C#C)*=>A&B879(') > **7'6'7#5#3#327#"'#5##53&'#7/75&'7535#35#35#'3'#' ) > Found an unknown keyword in AFM header (was ?)52 > > Je) > !_)nd an unknown keyword in AFM header (wasSS.,?+%"5??0 > Found an unknown keyword in AFM header (was > g > > > Perhaps this is related to the recent commit? > > -r > > > Rob Hetland, Associate Professor > Dept. of Oceanography, Texas A&M University > http://pong.tamu.edu/~rob > phone: 979-458-0096, fax: 979-845-6331 > > > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
> What are you setting in matplotlibrc (or in your plot?) > > Also, if you delete the font cache (which is now > ~/.matplotlib/fontManager.cache), does that help? (Might be a useful > data point -- not suggesting it as a solution.) Well, I've been trying out the Arev fonts, as you know, so I changed those back to Bitstream Vera Sans. I deleted the cache. I took out the mathtext stuff. All that is left is pretty vanilla rc. Perhaps it's a Mac thing? Also, revision 3700 works, so that can at least frame the initiation of the bug. I can whittle this down to the exact revision (there are only nine since 3700), if that is needed, -r Rob Hetland, Associate Professor Dept. of Oceanography, Texas A&M University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
Mike, Rob, One of the changes I made was to cause the afmdict to be generated automatically at the start rather than on demand. The problem you are having seems related to afm fonts, so I suspect this is it. What is your rcParams['pdf.use14corefonts'] setting? Please try reversing it, and see if that changes the result. This is looking for a clue, not a solution. (I knew I should have left the font stuff alone...) Thanks. Eric Michael Droettboom wrote: > Hmm... I'm not readily able to reproduce this here. > > What are you setting in matplotlibrc (or in your plot?) > > Also, if you delete the font cache (which is now > ~/.matplotlib/fontManager.cache), does that help? (Might be a useful > data point -- not suggesting it as a solution.) > > Cheers, > Mike > > Rob Hetland wrote: >>> Done and committed. >> >> It seems a recent commit has severely broken my font loading. When I >> start MPL now, I get an infinite stream of messages similar to: >> >> Found an unknown keyword in AFM header (was ) >> Found an unknown keyword in AFM header (was !"% >> #*3*9*:*<[EMAIL PROTECTED]@";;"C#C)*=>A&B879(') >> **7'6'7#5#3#327#"'#5##53&'#7/75&'7535#35#35#'3'#' ) >> Found an unknown keyword in AFM header (was ?)52 >> >> Je) >> !_)nd an unknown keyword in AFM header (wasSS.,?+%"5??0 >> Found an unknown keyword in AFM header (was >> g >> >> >> Perhaps this is related to the recent commit? >> >> -r >> >> >> Rob Hetland, Associate Professor >> Dept. of Oceanography, Texas A&M University >> http://pong.tamu.edu/~rob >> phone: 979-458-0096, fax: 979-845-6331 >> >> >> >> - >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> ___ >> Matplotlib-devel mailing list >> Matplotlib-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
On Aug 14, 2007, at 1:55 PM, Eric Firing wrote: > rcParams['pdf.use14corefonts'] Indeed, reversing this value fixes the problem. My value had been set to False. pdf.use14corefonts : True in the mplrc file works with the latest revision. -r Rob Hetland, Associate Professor Dept. of Oceanography, Texas A&M University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Font installation stuff
Rob, Mike, What this implies to me is that either there is a problem with the code that is generating afmdict (and I did not change that code, I just caused it to be invoked when the fontManager instance is created.), or there is a problem with some .afm files on Rob's machine. I really don't know how to troubleshoot it beyond this. (As a separate issue, I probably I should change font_manager.py so that if the rcParams value below was changed since the cache was made, it will be rebuilt with the new value.) Eric Rob Hetland wrote: > On Aug 14, 2007, at 1:55 PM, Eric Firing wrote: > >> rcParams['pdf.use14corefonts'] > > Indeed, reversing this value fixes the problem. > > My value had been set to False. > pdf.use14corefonts : True > in the mplrc file works with the latest revision. > > -r > > > Rob Hetland, Associate Professor > Dept. of Oceanography, Texas A&M University > http://pong.tamu.edu/~rob > phone: 979-458-0096, fax: 979-845-6331 > > > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Cannot set nonpositive limits with log transform
mpl hates my guts today. I'm developing an application for work and need to plot some spectra on a logscale. I can recreate my problem with embedding_in_qt4, by replacing MyDynamicMplCanvas.compute_initial_figure with this: def compute_initial_figure(self): self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') self.axes.set_yscale('log') [...] File "/usr/lib64/python2.5/site-packages/matplotlib-0.90.1_r3709-py2.5-linux-x86_64.egg/matplotlib/axes.py", line 1664, in set_ylim raise ValueError('Cannot set nonpositive limits with log transform') ValueError: Cannot set nonpositive limits with log transform I get that error even if I modify the update figure function so there is no possibility of zeros occuring in the data: def update_figure(self): # Build a list of 4 random integers between 0 and 10 (both inclusive) l = [ random.randint(0, 10) for i in xrange(4) ] l[l<=0]=1 # I love numpy self.axes.plot([1, 1, 2, 3], l, 'r') self.draw() Anyone have any ideas? I think I have a bad case of gremlins. Darren - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel