From: Alex R. <ale...@gm...> - 2005-02-27 22:54:30
|
Hi, I'm new to pylab, and I find it very usefull. I want to know how is possibile to change font properties in legend (I particular fontsize): I tried adding "prop = FontProperties("smaller")" in legend(), but this give me an error... maybe I'm wrong... Thanks, Alex. |
From: Robert L. <ro...@le...> - 2005-02-27 23:17:12
|
Alex Rada wrote: > Hi, > > I'm new to pylab, and I find it very usefull. I want to know how is > possibile to change font properties in legend (I particular fontsize): I > tried adding "prop = FontProperties("smaller")" in legend(), but this > give me an error... maybe I'm wrong... > Try: prop = FontProperties( size="smaller" ) From font_manager.py: 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. Robert |
From: kristen k. <co...@ya...> - 2005-03-01 09:23:51
|
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. Kristen __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo |
From: John H. <jdh...@ac...> - 2005-03-01 14:34:38
|
>>>>> "kristen" == kristen kaasbjerg <co...@ya...> writes: kristen> Hi everyone Does anyone know how to asign different kristen> patches in legend when plotting 2 or more histograms in kristen> the same figure. I've tried: kristen> legend((patches1,patches2),(hist1,hist2)) , kristen> 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 |
From: kristen k. <co...@ya...> - 2005-03-02 09:19:35
|
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/ |
From: Robert L. <ro...@le...> - 2005-03-02 09:52:48
|
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.... |
From: John H. <jdh...@ac...> - 2005-03-02 14:46:15
|
>>>>> "kristen" == kristen kaasbjerg <co...@ya...> writes: kristen> Hi again Working with legend I've encountered another kristen> problem. Changing the fontsize in a legend seems to be a kristen> little harder than first assumed. Is there an easy way to kristen> do this?? http://matplotlib.sf.net/examples/legend_demo.py shows you how to customize the legend text font size. The examples directory is really an indispensable tool in learning matplotlib. If you are using the source distribution, the examples directory is included. If you are using a binary distribution, a zip file is found here http://matplotlib.sourceforge.net/matplotlib_examples_0.72.zip The relevant code fragment from legend_demo.py is ltext = leg.get_texts() # all the text.Text instance in the legend set(ltext, fontsize='small') # the legend text fontsize JDH |