On Sat, Feb 28, 2009 at 5:31 PM, per freem <perfr...@gmail.com> wrote: > thank you for your reply. when i try either of the first suggestions about > changing the fonts, i get the error: > > AttributeError: 'FontProperties' object has no attribute 'get_slant' > > any idea what this means?
It seems that you're using v0.98.3 or before. See if following code works. from matplotlib.font_manager import FontProperties def my_hash(self): l = [self.get_family(), self.get_style(), self.get_variant(), self.get_weight(), self.get_stretch(), self.get_size()] return hash(repr(l)) FontProperties.__hash__ = my_hash > > also, i do not mind setting the position of each tickmark individually but i > cannot find a way to do this -- could you please explain how this can be > done? > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xticks http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.yticks -JJ > thanks again. > > > On Sat, Feb 28, 2009 at 5:19 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote: >> >> > but it does not work. i tried similarly setting the font size (with >> > set_size() or through rcParams) but it did not work either. how can i do >> > this? i'd like to do this either on per axes basis, or for the entire >> > figure. >> >> It seems that changing rcParams is not effective because of the way >> how the font caching is done. Here is a little monkey patching to >> change this behavior. >> >> from matplotlib.font_manager import FontProperties >> >> def my_hash(self): >> l = dict([(k, getattr(self, "get" + k)()) for k in self.__dict__]) >> return hash(repr(l)) >> >> FontProperties.__hash__ = my_hash >> >> >> With this code, changing rcParams will affect (most of) the text in the >> figure. >> >> As far as I know, you cannot have a default font properties on per >> axes basis. You need to manually change the font properties of Text >> artists in your interests. >> >> For example, to change the font properties of the xtick labels, >> >> fp = FontProperties(family="Lucida Sans Typewriter") >> ax = gca() >> for t in ax.get_xticklabels(): >> t.set_fontproperties(fp) >> >> >> > >> > second, how can i make it so axes labels do not overlap? in many plots, >> > including ones in the gallery, you see the labels at the origin of plots >> > get >> > too close to each other. (i.e. the 0.0 of x-axis and 0.0 of y-axis) - >> > how >> > can you prevent this from happening? >> > >> >> I don't think there is a smart way to prevent it other than manually >> changing the tick positions. Other may have better ideas. >> >> -JJ > > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users