fontfamily broken

The online documentation indicates that either “family”, “fontfamily”, “fontname”, or “name” can be used in all the standard text methods. However, I have found that the implementation for “fontfamily” seems to be missing. This is the traceback I get when I try to use it:

Traceback (most recent call last):
File “test0.py”, line 10, in
ax.set_title(“Title”, fontfamily=‘serif’)
File “C:\Python26\lib\site-packages\matplotlib\axes.py”, line 2735, in set_title
self.title.update(kwargs)
File “C:\Python26\lib\site-packages\matplotlib\artist.py”, line 621, in update

raise AttributeError(‘Unknown property %s’%k)
AttributeError: Unknown property fontfamily

And here is some simple code that triggers the bug and exercises the text API:

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter([1,2,3],[3,1,2])

ax.set_title(“Title”, family=‘serif’)
ax.set_title(“Title”, fontfamily=‘serif’)
ax.set_title(“Title”, fontname=‘serif’)
ax.set_title(“Title”, name=‘serif’)
ax.set_title(“Title”, size=‘large’)
ax.set_title(“Title”, fontsize=‘large’)
ax.set_title(“Title”, style=‘italic’)
ax.set_title(“Title”, fontstyle=‘italic’)
ax.set_title(“Title”, weight=‘bold’)
ax.set_title(“Title”, fontweight=‘bold’)

ax.set_xlabel(“x label”, family=‘serif’)
ax.set_xlabel(“x label”, fontfamily=‘serif’)
ax.set_xlabel(“x label”, fontname=‘serif’)
ax.set_xlabel(“x label”, name=‘serif’)
ax.set_xlabel(“x label”, size=‘large’)
ax.set_xlabel(“x label”, fontsize=‘large’)
ax.set_xlabel(“x label”, style=‘italic’)
ax.set_xlabel(“x label”, fontstyle=‘italic’)
ax.set_xlabel(“x label”, weight=‘bold’)
ax.set_xlabel(“x label”, fontweight=‘bold’)

ax.text(1,1,“Foo”, family=‘serif’)
ax.text(1,1,“Foo”, fontfamily=‘serif’)
ax.text(1,1,“Foo”, fontname=‘serif’)
ax.text(1,1,“Foo”, name=‘serif’)
ax.text(1,1,“Foo”, size=‘large’)
ax.text(1,1,“Foo”, fontsize=‘large’)
ax.text(1,1,“Foo”, style=‘italic’)
ax.text(1,1,“Foo”, fontstyle=‘italic’)
ax.text(1,1,“Foo”, weight=‘bold’)
ax.text(1,1,“Foo”, fontweight=‘bold’)

plt.show()

Thanks,

-Ben

Ben Axelrod

Robotics Engineer

(800) 641-2676 x737

image002.gif

www.coroware.com

www.corobot.net