> 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

Reply via email to