Re: [matplotlib-devel] patch: step function plotting

2007-08-14 Thread Eric Firing
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

2007-08-14 Thread Ted Drain

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

2007-08-14 Thread Rob Hetland
 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 !% 
##2*3*9*:*[EMAIL PROTECTED]@;;C#C)*=AB879(') 
**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 AM 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

2007-08-14 Thread Michael Droettboom
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 !% 
 ##2*3*9*:*[EMAIL PROTECTED]@;;C#C)*=AB879(') 
 **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 AM 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

2007-08-14 Thread Rob Hetland
 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 AM 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

2007-08-14 Thread Eric Firing
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 !% 
 ##2*3*9*:*[EMAIL PROTECTED]@;;C#C)*=AB879(') 
 **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 AM 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

2007-08-14 Thread Eric Firing
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 AM 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

2007-08-14 Thread Darren Dale
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