Hi everyone Does anyone know how to asign different
> patches in legend when plotting 2 or more histograms in
> the same figure. I've tried:
> legend((patches1,patches2),(hist1,hist2)) ,
> but this gives the same patches in the legend inset.
I'm assuming patches1 and patches2 are the return values from hist, in
which case they are each a *list* of patches. What you want to do is
pass a *single* item from each of those lists as representative
patches.
legend( (patches1[0],patches2[0]), ('label1', 'label2') )
Next time if you post a more complete code snippet, I won't have to
guess what patches1 and patches2 are!
Hope this helps,
JDH
Hi again
Working with legend I've encountered another problem.
Changing the fontsize in a legend seems to be a little
harder than first assumed. Is there an easy way to do
this??
Kristen
···
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/
kristen kaasbjerg wrote:
Hi again
Working with legend I've encountered another problem.
Changing the fontsize in a legend seems to be a little
harder than first assumed. Is there an easy way to do
this??
From the mailing list a couple of days ago...
You need to pass in a FontProperties instance that specifies the size you want:
prop = FontProperties(size="x-small')
size - Either an absolute value of xx-small, x-small, small,
medium, large, x-large, xx-large; or a relative value
of smaller or larger; or an absolute font size, e.g. 12;
or scalable
i.e. lgnd = ax.legend((lines, labels, prop = FontProperties(size="x-small'), ..other_params_as_required)
Robert
PS This looks like something to add to my 'Getting Started' document....