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?

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?

thanks again.

On Sat, Feb 28, 2009 at 5:19 PM, Jae-Joon Lee <> 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():

> 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.