Re: [Matplotlib-users] Discrete legend

2007-07-27 Thread Jouni K . Seppänen
"Jose Gomez-Dans" <[EMAIL PROTECTED]>
writes:

> I realise that the legend class has some support for patches, but how
> does one go about using them? I can't just add a legend (I get a very
> messy legend, one for every patch in my plot). 

Pass to the legend command a list of patches, and the legend will
only show those patches. Here's a quick example:

#!/usr/bin/env python
from numpy import *
from pylab import *
from matplotlib.patches import Polygon

square = array([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]])
reds=[]
for x,y in (0,0),(2,0),(1,1): reds.append(Polygon(square+(x,y), fc='red'))
blues = []
for x,y in (1,0),(0,1),(2,1): blues.append(Polygon(square+(x,y), fc='blue'))
for p in reds+blues: gca().add_patch(p)
axis((0,3,0,3))
legend([reds[0], blues[0]], ['foo', 'bar'])
show()

In the example there are six patches, but only two are passed to legend,
and those two are shown in the result.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks
-
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Crashing with a St8bad_cast

2007-07-27 Thread Jouni K . Seppänen
Steve Lianoglou
<[EMAIL PROTECTED]> writes:

> Trying to import pylab from the shell gives me a Bus Error.
 [...]
> Anybody have any ideas on what to do from here?

Follow the instructions in the SEGFAULTS file, which begins as follows:

| First thing to try is simply rm -rf the site-packages/matplotlib and
| build subdirs and get a clean install.  Installing a new version over
| a pretty old version has been known to cause trouble, segfault, etc.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pdf saving on OS X

2007-07-27 Thread Jouni K . Seppänen
Brian Blais <[EMAIL PROTECTED]> writes:

> This is the smallest example I can write.  I am embedding the figure
> in a wx window.  In this test case, I print (successfully) a PNG and
> EPS, but the PDF doesn't work (gets a .jpg attached to the end).

Right. It seems that the wx backend has special cases for postscript and
svg but not pdf, and for some reason defaults to jpeg format when it
cannot determine which format was needed. Here's a workaround for now:



binDkASyCT9Gy.bin
Description: application/python

-- 
Jouni K. Seppänen
http://www.iki.fi/jks
-
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users