>>>>> "Etrade" == Etrade Griffiths <[EMAIL PROTECTED]> writes:
Etrade> Sorry, another really basic matplotlib question ... how do Etrade> I set the font family of the axis tick labels? I am using Etrade> wxPython/wxMpl and not the pylab interface so am trying to Etrade> avoid getp/setp. I could do this using matplotlib.rc but Etrade> want to do it programatically Etrade> I tried Etrade> fig=self.get_figure() ax1=fig.gca() ax1.plot(x,y) Etrade> xt=ax1.get_xticklabels() d = { 'family' : 'sans-serif' } Etrade> ax1.set_xticklabels(xt, d) Etrade> But Python goes haywire ... There has to be a simpler way Etrade> but not found it yet. I'd like to deprecate font dictionaries in the sense you are using them here. I implemented them before I fully understood python kwarg processing. You can do everything with kwargs that you can do with dictionaries (since kwargs are dictionaries) so it is redundant and less pythonic. Since you are using the API, I suggest something like for tick in ax1.xaxis.get_major_ticks(): tick.label1.set_family('sans-serif') and ditto for the minor ticks if you need them. Also, since mpl supports left/right or top/bottom ticking, if you are using these you will also want to set the properties of tick.label2. Etrade> I am trying to do the same for the legend properties. So Etrade> far we have Etrade> p=matplotlib.font_manager.FontProperties() Etrade> p.set_family('sans-serif') p.set_size('small') Etrade> fig.legend(lines, titles, 'upper right', prop=p) Etrade> but this looks fairly cludgy - is there a more elegant way Etrade> of doing the same thing? I think this is elegant and not cludgy, so maybe I'm not the best one to answer this. JDH ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users