|
From: hari j. <ha...@gm...> - 2011-08-18 01:26:25
|
Thanks a lot John and Benjamin for your help.
The Proxy Artist approach fits the bill perfectly.
I used the following code to make a legend from my color_lut lookup table.
# Lookup table for color
col_lut = dict(Bistris7p2 = "burlywood", Cit7p2 = "c",APhosph8p0 = "m",
Acetate5p5 = "k",Borate8p5 = "y",Mes6p7 = "c",Hep8p2 = "g",ATris9p0 = "r")
for key,value in col_lut.items():
legend_box.append(Rectangle((0,0),1,1,fc="%s" % value))
legend_text.append(key)
ax.legend(legend_box, legend_text)
Hari
On Wed, Aug 17, 2011 at 7:23 PM, John Hunter <jd...@gm...> wrote:
> On Wed, Aug 17, 2011 at 5:30 PM, hari jayaram <ha...@gm...> wrote:
> > Thanks for your email Ben. Sorry I am still lost.
> >
> > I dont understand what the handles type is . In my example I guess the
> > handles are an array of circles representing each x,y,z point.I am still
> a
> > little lost since the plot autmatically plots my 3 arrays
> > The color of each circle is arbitrary and stored a the color array.
> > Even after looking at the examples I dont know how to construct
> > my plt.legend() call.
>
> Take a look at the proxy artist section of the legend guide and see if
> that helps
>
>
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>
> JDH
>
|