Matplotlib PyPlot savefig()错误';TrueType字体缺少表格';使用ttc字体时
我正在macOS 10.13上使用Julia language的PyPlot包。以下是生成问题的代码:Matplotlib PyPlot savefig()错误';TrueType字体缺少表格';使用ttc字体时,matplotlib,fonts,julia,Matplotlib,Fonts,Julia,我正在macOS 10.13上使用Julia language的PyPlot包。以下是生成问题的代码: using PyPlot PyPlot.svg(true) function myplot() my_font=matplotlib[:font_manager][:FontProperties](fname = "/System/Library/Fonts/Helvetica.ttc") fig, ax = subplots() ax[:plot](rand(10), rand
using PyPlot
PyPlot.svg(true)
function myplot()
my_font=matplotlib[:font_manager][:FontProperties](fname = "/System/Library/Fonts/Helvetica.ttc")
fig, ax = subplots()
ax[:plot](rand(10), rand(10), linewidth = 2)
for tick in ax[:xaxis][:get_major_ticks]()
tick[:label][:set_fontproperties](my_font)
end
for tick in ax[:yaxis][:get_major_ticks]()
tick[:label][:set_fontproperties](my_font)
end
savefig("figure.pdf")
end
myplot()
如您所见,我需要将记号标签的字体更改为Helvetica,它可以通过ttc文件在我的mac上获得。该图通常显示在Jupyter笔记本中。但是,对于savefig()
,它不起作用:
RuntimeError('TrueType font is missing table',)
我已经删除了~/.matplotlib/fontList.py3k.cache
和~/.matplotlib/tex.cache
。我还需要做什么才能使savefig()
正常工作?谢谢