Change Font Properties of Annotations

I’m having problems to simply set ‘bold’ the font weight of some annotations. Tryin’this:
fig = plt.figure(frameon=False)
ax = plt.gca()

font = matplotlib.font_manager.FontProperties(family=‘Tahoma’, weight=‘extra bold’, size=12)

annotation_total = ax.annotate(‘Total:’, xy=(0, -320), xycoords=‘axes points’, horizontalalignment=‘left’, verticalalignment=‘top’,
fontproperties=font)

The Family and Size work perfectly, only weight is ignored.

Can you add the following to the top of your script:

import matplotlib
matplotlib.rcParams['verbose.level'] = 'debug-annoying'

and send the output here?

Most likely the font matching is failing on some other property (e.g. Tahoma) and reverting to the default font, which is non-bold. I don't have the Microsoft fonts installed here, so I can't test whether there's something in particular about them that is causing this failure.

Cheers,
Mike

Gewton Jhames wrote:

···

I'm having problems to simply set 'bold' the font weight of some annotations. Tryin'this:
fig = plt.figure(frameon=False)
ax = plt.gca()

font = matplotlib.font_manager.FontProperties(family='Tahoma', weight='extra bold', size=12)

annotation_total = ax.annotate('Total:', xy=(0, -320), xycoords='axes points', horizontalalignment='left', verticalalignment='top',
fontproperties=font)
The Family and Size work perfectly, only weight is ignored.
------------------------------------------------------------------------

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

MIchael,

That’s it.

I don’t have microsoft fonts installed, so it’s really reverting to the default font. When I put ‘sans-serif’, instead of ‘Tahoma’, it works perfectly.

Thanks.

···

On Tue, Aug 4, 2009 at 11:40 AM, Michael Droettboom <mdroe@…86…> wrote:

Can you add the following to the top of your script:

import matplotlib

matplotlib.rcParams[‘verbose.level’] = ‘debug-annoying’

and send the output here?

Most likely the font matching is failing on some other property (e.g. Tahoma) and reverting to the default font, which is non-bold. I don’t have the Microsoft fonts installed here, so I can’t test whether there’s something in particular about them that is causing this failure.

Cheers,

Mike

Gewton Jhames wrote:

I’m having problems to simply set ‘bold’ the font weight of some annotations. Tryin’this:

fig = plt.figure(frameon=False)

ax = plt.gca()

font = matplotlib.font_manager.FontProperties(family=‘Tahoma’, weight=‘extra bold’, size=12)

annotation_total = ax.annotate(‘Total:’, xy=(0, -320), xycoords=‘axes points’, horizontalalignment=‘left’, verticalalignment=‘top’,

fontproperties=font)

The Family and Size work perfectly, only weight is ignored.



Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what’s new with Crystal Reports now. http://p.sf.net/sfu/bobj-july



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Michael Droettboom

Science Software Branch

Operations and Engineering Division

Space Telescope Science Institute

Operated by AURA for NASA