need help with Times New Roman font.

Hi all.
I want to use "Times New Roman" font for my pictures.
Searching the list I have found this solution:

···

__________________
....
pylab.rc('font', family='serif')
pylab.rc('font', serif='Times New Roman')
pylab.rc('text', usetex='false')
......
____________________

yl=pylab.ylabel(r'Difference extinction coeffitient, (M \\times cm^\{\-1\}\)',fontsize=8)
xl=pylab.xlabel("Wavelength, (nm)", fontsize=8)

However it still does not use Times new roman.

yl.get_fontname()

'DejaVu Serif'

xl.get_fontname()

'DejaVu Serif'

I have the font:

font_manager.findfont('Times New Roman')

'/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf'

and here are rcparams

font_manager.rcParams

{'figure.subplot.right': 0.90000000000000002, 'mathtext.cal':
'cursive', 'font.fantasy': ['Comic Sans MS', 'Chicago', 'Charcoal',
'ImpactWestern', 'fantasy'], 'xtick.minor.pad': 4, 'tk.pythoninspect':
False, 'image.aspect': 'equal', 'font.cursive': ['Apple Chancery',
'Textile', 'Zapf Chancery', 'Sand', 'cursive'],
'figure.subplot.hspace': 0.20000000000000001, 'xtick.direction': 'in',
'axes.facecolor': 'w', 'mathtext.fontset': 'cm', 'ytick.direction':
'in', 'svg.image_inline': True, 'lines.markersize': 6, 'figure.dpi':
100.0, 'text.usetex': False, 'text.fontangle': 'normal',
'patch.edgecolor': 'k', 'legend.labelspacing': 0.5, 'ps.useafm':
False, 'mathtext.bf': 'serif:bold', 'lines.solid_joinstyle': 'round',
'font.monospace': ['Bitstream Vera Sans Mono', 'DejaVu Sans Mono',
'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier', 'Fixed',
'Terminal', 'monospace'], 'xtick.minor.size': 2,
'axes.formatter.limits': [-7, 7], 'figure.subplot.wspace':
0.20000000000000001, 'savefig.edgecolor': 'w', 'text.fontvariant':
'normal', 'image.cmap': 'jet', 'axes.edgecolor': 'k',
'tk.window_focus': False, 'image.origin': 'upper', 'text.fontsize':
'medium', 'font.serif': ['Times New Roman'], 'savefig.facecolor': 'w',
'maskedarray': 'obsolete', 'ytick.minor.size': 2, 'numerix':
'obsolete', 'font.stretch': 'normal', 'text.dvipnghack': None,
'ytick.color': 'k', 'lines.linestyle': '-', 'xtick.color': 'k',
'xtick.major.pad': 4, 'text.fontweight': 'normal', 'patch.facecolor':
'b', 'figure.figsize': [5.5999999999999996, 3.4609903369994113],
'axes.linewidth': 1.0, 'legend.handletextpad': 0.80000000000000004,
'mathtext.fallback_to_cm': True, 'lines.linewidth': 1.0,
'savefig.dpi': 100, 'verbose.fileo': 'sys.stdout',
'svg.image_noscale': False, 'docstring.hardcopy': False, 'font.size':
12.0, 'ps.fonttype': 3, 'path.simplify': True, 'polaraxes.grid': True,
'toolbar': 'toolbar2', 'pdf.compression': 6, 'grid.linewidth': 0.5,
'figure.autolayout': False, 'figure.facecolor': '0.75',
'ps.usedistiller': False, 'legend.isaxes': True, 'figure.edgecolor':
'w', 'mathtext.tt': 'monospace', 'contour.negative_linestyle':
'dashed', 'image.interpolation': 'bilinear', 'lines.markeredgewidth':
0.5, 'axes3d.grid': True, 'lines.marker': 'None', 'legend.shadow':
False, 'axes.titlesize': 'large', 'backend': 'TkAgg',
'xtick.major.size': 4, 'legend.fontsize': 'large',
'lines.solid_capstyle': 'projecting', 'mathtext.it': 'serif:italic',
'font.variant': 'normal', 'xtick.labelsize': 8.0,
'axes.unicode_minus': True, 'ps.distiller.res': 6000, 'pdf.fonttype':
3, 'patch.linewidth': 1.0, 'pdf.inheritcolor': False,
'lines.dash_capstyle': 'butt', 'lines.color': 'b',
'text.latex.preview': False, 'figure.subplot.top':
0.90000000000000002, 'pdf.use14corefonts': False,
'legend.markerscale': 1.0, 'patch.antialiased': True, 'font.style':
'normal', 'backend_fallback': True, 'legend.fancybox': False,
'grid.linestyle': ':', 'axes.labelcolor': 'k', 'text.color': 'k',
'mathtext.rm': 'serif', 'legend.loc': 'upper right', 'interactive':
True, 'cairo.format': 'png', 'savefig.orientation': 'portrait',
'axes.axisbelow': False, 'ytick.major.size': 4, 'axes.grid': False,
'plugins.directory': '.matplotlib_plugins', 'grid.color': 'k',
'timezone': 'UTC', 'ytick.major.pad': 4, 'legend.borderpad':
0.40000000000000002, 'lines.dash_joinstyle': 'round', 'datapath':
'/usr/share/matplotlib/mpl-data', 'lines.antialiased': True,
'text.latex.unicode': False, 'image.lut': 256, 'units': False,
'figure.subplot.bottom': 0.10000000000000001, 'text.latex.preamble':
[''], 'legend.numpoints': 2, 'legend.handlelength': 2.0,
'font.sans-serif': ['Bitstream Vera Sans', 'DejaVu Sans', 'Lucida
Grande', 'Verdana', 'Geneva', 'Lucid', 'Arial', 'Helvetica', 'Avant
Garde', 'sans-serif'], 'font.family': 'serif', 'axes.labelsize':
'medium', 'ytick.minor.pad': 4, 'legend.borderaxespad': 0.5,
'mathtext.sf': 'sans\\-serif', 'axes.hold': True, 'verbose.level':
'silent', 'mathtext.default': 'regular', 'figure.subplot.left': 0.125,
'legend.columnspacing': 2.0, 'text.fontstyle': 'normal',
'font.weight': 'normal', 'image.resample': False,
'agg.path.chunksize': 0, 'path.simplify_threshold':
0.1111111111111111, 'ytick.labelsize': 8.0, 'ps.papersize': 'letter',
'svg.embed_char_paths': True}

Any tips?
Thanks.
Petro.
___________________________________

I can’t reproduce this issue, but there was a recent thread about this exact same issue, so apparently this is not a fluke of your system configuration. Since I can’t reproduce this issue, I probably won’t be of much help, but some specifics of your install might help others diagnose this issue. What version of Matplotlib are you running?

Best,
-Tony

···

On Wed, Dec 7, 2011 at 8:27 PM, Piter_ <x.piter@…287…> wrote:

Hi all.

I want to use “Times New Roman” font for my pictures.

Searching the list I have found this solution:


pylab.rc(‘font’, family=‘serif’)

pylab.rc(‘font’, serif=‘Times New Roman’)

pylab.rc(‘text’, usetex=‘false’)


yl=pylab.ylabel(r’Difference extinction coeffitient, ($M \times

cm^{-1})$',fontsize=8)

xl=pylab.xlabel(“Wavelength, (nm)”, fontsize=8)

However it still does not use Times new roman.

yl.get_fontname()

‘DejaVu Serif’

xl.get_fontname()

‘DejaVu Serif’

I have the font:

font_manager.findfont(‘Times New Roman’)

‘/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf’

and here are rcparams

font_manager.rcParams

{‘figure.subplot.right’: 0.90000000000000002, ‘mathtext.cal’:

‘cursive’, ‘font.fantasy’: [‘Comic Sans MS’, ‘Chicago’, ‘Charcoal’,

‘ImpactWestern’, ‘fantasy’], ‘xtick.minor.pad’: 4, ‘tk.pythoninspect’:

False, ‘image.aspect’: ‘equal’, ‘font.cursive’: [‘Apple Chancery’,

‘Textile’, ‘Zapf Chancery’, ‘Sand’, ‘cursive’],

‘figure.subplot.hspace’: 0.20000000000000001, ‘xtick.direction’: ‘in’,

‘axes.facecolor’: ‘w’, ‘mathtext.fontset’: ‘cm’, ‘ytick.direction’:

‘in’, ‘svg.image_inline’: True, ‘lines.markersize’: 6, ‘figure.dpi’:

100.0, ‘text.usetex’: False, ‘text.fontangle’: ‘normal’,

‘patch.edgecolor’: ‘k’, ‘legend.labelspacing’: 0.5, ‘ps.useafm’:

False, ‘mathtext.bf’: ‘serif:bold’, ‘lines.solid_joinstyle’: ‘round’,

‘font.monospace’: [‘Bitstream Vera Sans Mono’, ‘DejaVu Sans Mono’,

‘Andale Mono’, ‘Nimbus Mono L’, ‘Courier New’, ‘Courier’, ‘Fixed’,

‘Terminal’, ‘monospace’], ‘xtick.minor.size’: 2,

‘axes.formatter.limits’: [-7, 7], ‘figure.subplot.wspace’:

0.20000000000000001, ‘savefig.edgecolor’: ‘w’, ‘text.fontvariant’:

‘normal’, ‘image.cmap’: ‘jet’, ‘axes.edgecolor’: ‘k’,

‘tk.window_focus’: False, ‘image.origin’: ‘upper’, ‘text.fontsize’:

‘medium’, ‘font.serif’: [‘Times New Roman’], ‘savefig.facecolor’: ‘w’,

‘maskedarray’: ‘obsolete’, ‘ytick.minor.size’: 2, ‘numerix’:

‘obsolete’, ‘font.stretch’: ‘normal’, ‘text.dvipnghack’: None,

‘ytick.color’: ‘k’, ‘lines.linestyle’: ‘-’, ‘xtick.color’: ‘k’,

‘xtick.major.pad’: 4, ‘text.fontweight’: ‘normal’, ‘patch.facecolor’:

‘b’, ‘figure.figsize’: [5.5999999999999996, 3.4609903369994113],

‘axes.linewidth’: 1.0, ‘legend.handletextpad’: 0.80000000000000004,

‘mathtext.fallback_to_cm’: True, ‘lines.linewidth’: 1.0,

‘savefig.dpi’: 100, ‘verbose.fileo’: ‘sys.stdout’,

‘svg.image_noscale’: False, ‘docstring.hardcopy’: False, ‘font.size’:

12.0, ‘ps.fonttype’: 3, ‘path.simplify’: True, ‘polaraxes.grid’: True,

‘toolbar’: ‘toolbar2’, ‘pdf.compression’: 6, ‘grid.linewidth’: 0.5,

‘figure.autolayout’: False, ‘figure.facecolor’: ‘0.75’,

‘ps.usedistiller’: False, ‘legend.isaxes’: True, ‘figure.edgecolor’:

‘w’, ‘mathtext.tt’: ‘monospace’, ‘contour.negative_linestyle’:

‘dashed’, ‘image.interpolation’: ‘bilinear’, ‘lines.markeredgewidth’:

0.5, ‘axes3d.grid’: True, ‘lines.marker’: ‘None’, ‘legend.shadow’:

False, ‘axes.titlesize’: ‘large’, ‘backend’: ‘TkAgg’,

‘xtick.major.size’: 4, ‘legend.fontsize’: ‘large’,

‘lines.solid_capstyle’: ‘projecting’, ‘mathtext.it’: ‘serif:italic’,

‘font.variant’: ‘normal’, ‘xtick.labelsize’: 8.0,

‘axes.unicode_minus’: True, ‘ps.distiller.res’: 6000, ‘pdf.fonttype’:

3, ‘patch.linewidth’: 1.0, ‘pdf.inheritcolor’: False,

‘lines.dash_capstyle’: ‘butt’, ‘lines.color’: ‘b’,

‘text.latex.preview’: False, ‘figure.subplot.top’:

0.90000000000000002, ‘pdf.use14corefonts’: False,

‘legend.markerscale’: 1.0, ‘patch.antialiased’: True, ‘font.style’:

‘normal’, ‘backend_fallback’: True, ‘legend.fancybox’: False,

‘grid.linestyle’: ‘:’, ‘axes.labelcolor’: ‘k’, ‘text.color’: ‘k’,

‘mathtext.rm’: ‘serif’, ‘legend.loc’: ‘upper right’, ‘interactive’:

True, ‘cairo.format’: ‘png’, ‘savefig.orientation’: ‘portrait’,

‘axes.axisbelow’: False, ‘ytick.major.size’: 4, ‘axes.grid’: False,

‘plugins.directory’: ‘.matplotlib_plugins’, ‘grid.color’: ‘k’,

‘timezone’: ‘UTC’, ‘ytick.major.pad’: 4, ‘legend.borderpad’:

0.40000000000000002, ‘lines.dash_joinstyle’: ‘round’, ‘datapath’:

‘/usr/share/matplotlib/mpl-data’, ‘lines.antialiased’: True,

‘text.latex.unicode’: False, ‘image.lut’: 256, ‘units’: False,

‘figure.subplot.bottom’: 0.10000000000000001, ‘text.latex.preamble’:

[‘’], ‘legend.numpoints’: 2, ‘legend.handlelength’: 2.0,

‘font.sans-serif’: [‘Bitstream Vera Sans’, ‘DejaVu Sans’, 'Lucida

Grande’, ‘Verdana’, ‘Geneva’, ‘Lucid’, ‘Arial’, ‘Helvetica’, 'Avant

Garde’, ‘sans-serif’], ‘font.family’: ‘serif’, ‘axes.labelsize’:

‘medium’, ‘ytick.minor.pad’: 4, ‘legend.borderaxespad’: 0.5,

‘mathtext.sf’: ‘sans\-serif’, ‘axes.hold’: True, ‘verbose.level’:

‘silent’, ‘mathtext.default’: ‘regular’, ‘figure.subplot.left’: 0.125,

‘legend.columnspacing’: 2.0, ‘text.fontstyle’: ‘normal’,

‘font.weight’: ‘normal’, ‘image.resample’: False,

‘agg.path.chunksize’: 0, ‘path.simplify_threshold’:

0.1111111111111111, ‘ytick.labelsize’: 8.0, ‘ps.papersize’: ‘letter’,

‘svg.embed_char_paths’: True}

Any tips?

Thanks.

Petro.