[Matplotlib-users] two legends

2008-08-20 Thread Yves Revaz
Hi,

How is it possible to add two legends in the same plot ?

Of course, if I try :
pt.legend(crv_lst,labels1,loc='upper right',shadow=True)
pt.legend(crv_lst,labels2,loc='upper left',shadow=True)

the first one is erased by the second one... :-(

Thanks in advance,

yves



-- 
 (o o)
oOO--(_)--OOo---
  Yves Revaz
  Laboratory of Astrophysics EPFL
  Observatoire de Sauverny Tel : ++ 41 22 379 24 28
  51. Ch. des Maillettes   Fax : ++ 41 22 379 22 05
  1290 Sauverny e-mail : [EMAIL PROTECTED]
  SWITZERLAND  Web : http://www.lunix.ch/revaz/



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] minorLocator

2008-08-20 Thread Yves Revaz
Yves Revaz wrote:
> Hi all,
>
> How is it possible to display by default the minor ticks with an
> interval 5 times
> smaller than the major ticks.
>
> I can do that for a known range of data : for example :
>
> ax = pt.gca()
> ax.xaxis.set_major_locator(MultipleLocator(10))
> ax.xaxis.set_minor_locator(MultipleLocator(10/5.))
>
>
> but I would like to have the major still set by default, i.e. :
> ax.xaxis.set_major_locator(AutoLocator())
>
> and now the minor automatically set to 1/5. of the value used for the major.
>
> How can I do that ?
>   
Dear Yves,

Here is the trick :

ax = gca()
ax.xaxis.set_major_locator(AutoLocator())
x_major = ax.xaxis.get_majorticklocs()
dx_minor =  (x_major[-1]-x_major[0])/(len(x_major)-1) /5.
ax.xaxis.set_minor_locator(MultipleLocator(dx_minor))

Cheers !

yves




>
> Thanks for your help,
>
> yves
>
>   


>
>
> --
>  (o o)
> oOO--(_)--OOo---
>   Yves Revaz
>   Laboratory of Astrophysics EPFL
>   Observatoire de Sauverny Tel : ++ 41 22 379 24 28
>   51. Ch. des Maillettes   Fax : ++ 41 22 379 22 05
>   1290 Sauverny e-mail : [EMAIL PROTECTED]
>   SWITZERLAND  Web : http://www.lunix.ch/revaz/
> 
>
>
> -
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   


-- 
 (o o)
oOO--(_)--OOo---
  Yves Revaz
  Laboratory of Astrophysics EPFL
  Observatoire de Sauverny Tel : ++ 41 22 379 24 28
  51. Ch. des Maillettes   Fax : ++ 41 22 379 22 05
  1290 Sauverny e-mail : [EMAIL PROTECTED]
  SWITZERLAND  Web : http://www.lunix.ch/revaz/



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] two legends

2008-08-20 Thread Jae-Joon Lee
Hi,

The legend of an axes instance is stored in axes.legend_ attribute.
And your second legend call will simply rebind this attribute to the
new legend object, and the first one is never drawn. You may make a
custom Axes class which can hold multiple legends. But if you want
something quick,

 first_legend = pt.legend(crv_lst,labels1,loc='upper right',shadow=True)
 pt.legend(crv_lst,labels2,loc='upper left',shadow=True)
 gca().add_artist(first_legend)
 draw()

It works for my quick test.

-JJ



On Wed, Aug 20, 2008 at 6:17 AM, Yves Revaz <[EMAIL PROTECTED]> wrote:
> Hi,
>
> How is it possible to add two legends in the same plot ?
>
> Of course, if I try :
> pt.legend(crv_lst,labels1,loc='upper right',shadow=True)
> pt.legend(crv_lst,labels2,loc='upper left',shadow=True)
>
> the first one is erased by the second one... :-(
>
> Thanks in advance,
>
> yves
>
>
>
> --
> (o o)
> oOO--(_)--OOo---
>  Yves Revaz
>  Laboratory of Astrophysics EPFL
>  Observatoire de Sauverny Tel : ++ 41 22 379 24 28
>  51. Ch. des Maillettes   Fax : ++ 41 22 379 22 05
>  1290 Sauverny e-mail : [EMAIL PROTECTED]
>  SWITZERLAND  Web : http://www.lunix.ch/revaz/
> 
>
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Slow drawing of many lines in Basemap

2008-08-20 Thread Zane Selvans
I'm drawing several hundred lines at a time, each consisting of 10-100  
points, and it takes a couple of minutes for them all to display,  
which makes me think I must be doing something stupid.

The function that does the drawing looks like this:

def plotlinmap(lins, map=None):
 if map is None:
 map = Basemap()

 map.drawmapboundary(fill_color="white")
 map.drawmeridians(range(-180,181,30)), labels=[1,0,0,1])
 map.drawparallels(range(-90,91,30)), labels=[1,0,0,1])

 for lin in lins:
 x,y = map(degrees(lin.longitudes()),degrees(lin.latitudes()))
 map.plot(x,y)

 return(map)

It displays one line at a time, whenever map.plot() is called.  Really  
I'd like it to just do all the drawing at the end (assuming that would  
make the whole process much faster).  Is there some way to cleanly  
pass map.plot() a big list of lines to draw?  I'm sure there is and  
I'm just being dense.  Argh.

--
Zane Selvans
Amateur Earthling
http://zaneselvans.org
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] two legends

2008-08-20 Thread Benoit Donnet
Hi,

Here is a piece of code I recently used for plotting 2 different  
legends.  This is not the most sexy code in the world but it works.

#axis and legend
axis([-0.1, 3.1, 0, 1], font)
xlabel(r'\textrm{relative error}', font)
ylabel(r'\textrm{cdf}', font)

rc('legend', numpoints=1)
leg1 = figlegend((lrep20[0], lrep50[0], lrep70[0]), (r'\textrm 
{reputation - 20\%}', r'\textrm{reputation - 50\%}', r'\textrm 
{reputation - 70\%}'), loc=(0.25, 0.11), prop=FontProperties 
(size='45', weight='bold'))
leg1.draw_frame(False)

rc('legend', numpoints=3)
leg2 = figlegend((lwithout20[0], lwithout50[0], lwithout70[0], lref 
[0]), (r'\textrm{20\%}', r'\textrm{50\%}', r'\textrm{70\%}', r'\textrm 
{reference}'), loc=(0.68, 0.08), prop=FontProperties(size='45',  
weight='bold'))
leg2.draw_frame(False)

Keep on Rockin'

Benoit

Le 20-août-08 à 12:17, Yves Revaz a écrit :

> Hi,
>
> How is it possible to add two legends in the same plot ?
>
> Of course, if I try :
> pt.legend(crv_lst,labels1,loc='upper right',shadow=True)
> pt.legend(crv_lst,labels2,loc='upper left',shadow=True)
>
> the first one is erased by the second one... :-(
>
> Thanks in advance,
>
> yves
>
>
>
> -- 
>  (o o)
> oOO--(_)--OOo---
>   Yves Revaz
>   Laboratory of Astrophysics EPFL
>   Observatoire de Sauverny Tel : ++ 41 22 379 24 28
>   51. Ch. des Maillettes   Fax : ++ 41 22 379 22 05
>   1290 Sauverny e-mail : [EMAIL PROTECTED]
>   SWITZERLAND  Web : http://www.lunix.ch/revaz/
> 
>
>
> -- 
> ---
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Dr. Benoit Donnet
Université catholique de Louvain (UCL)
Ecole Polytechnique de Louvain (EPL) - Département d'Ingénierie  
Informatique (INGI)
Place Sainte Barbe, 2
1348 Louvain-la-Neuve
Belgium
Phone: +32 10 47 87 18
Home page: http://inl.info.ucl.ac.be/donnet





-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users