David M. Kaplan wrote:
> Hi,
>
> I just upgraded to matplotlib 0.98.1 on a ubuntu hardy heron system.  I
> have noticed two problems since the upgrade:
>
> 1) For any plot, if I try to look at the properties of a text object I
> get an error related to FontProperties having no attribute 'items'.  See
> below:
>
> In [1]: plot(range(10))
> Out[1]: [<matplotlib.lines.Line2D object at 0x924f9ac>]
>
> In [2]: xlh=get(gca(),'xticklabels')
>
> In [3]: get(xlh[0])
> ------------------------------------------------------------
> Traceback (most recent call last):
>   File "<ipython console>", line 1, in <module>
>   File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line
> 724, in get
>     return getp(o, *args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line
> 716, in getp
>     print '\n'.join(insp.pprint_getters())
>   File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line
> 684, in pprint_getters
>     s = str(val)
>   File "/usr/lib/python2.5/site-packages/matplotlib/font_manager.py",
> line 681, in __str__
>     return self.get_fontconfig_pattern()
>   File "/usr/lib/python2.5/site-packages/matplotlib/font_manager.py",
> line 737, in get_fontconfig_pattern
>     return generate_fontconfig_pattern(self)
>   File
> "/usr/lib/python2.5/site-packages/matplotlib/fontconfig_pattern.py",
> line 164, in generate_fontconfig_pattern
>     for key, val in d.items():
> <type 'exceptions.AttributeError'>: 'FontProperties' object has no
> attribute 'items'
>   
Thanks for the report.  This is a bug and should now be fixed in SVN.
> 2) I have noticed that the font used for the xticklabels and the font
> used for the xlabel and contour labels appears to be different (example
> attached).  One appears to be serif and the other sans-serif.  This
> seems to be due to using tex for text rendering.  I am not sure if this
> also occurred before the update, but I didn't notice it previously.
> Looking at the properties of the different text objects, it isn't
> apparent that there should be a difference - both have font properties
> that indicate sans-serif, but the text of tick labels appears to be
> surrounded by $'s forcing it through the text parser, while that of the
> contour labels is not.  Is this difference normal or expected?  Is there
> a way around this?  In particular, I would like to use sans-serif for
> everything - is this possible while still using tex?
>   
To clarify -- you've set the rcParam "text.usetex" to True?

If the tick labels are in fact surrounded by $'s, then, yes, TeX will 
render then in a serif font.  This is the default behavior of TeX (math 
is in a serif font) -- though there might be a special package you could 
add to the preamble (the rcParam text.latex.preamble) to change this, 
but that's more of a (La)TeX issue.

Looking at the revision history, it looks like putting $'s around tick 
labels has been done since at least 0.90.1.

Perhaps one of the usetex developers/users has more insight into this 
than I do.

Cheers,
Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to