matplotlib 用极坐标绘制 pdf 错误

问题描述

我想绘制并保存为 pdf:

enter image description here

这是我目前所做的:

import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.gridspec as gridspec
#------------------------------------------------------------------------------
plt.rc('font',family='sans',size=24)
matplotlib.rc('text',usetex=True)
matplotlib.rc('legend',fontsize=24) 
matplotlib.rcParams['text.latex.preamble'] = [r'\boldmath']

fnameout = 'test'

fig = plt.figure(figsize=(20,6))
G = gridspec.GridSpec(1,3)

plt.subplots_adjust(left=0.08,right=0.94,top=0.94,bottom=0.08,wspace=0.24,hspace=0.14)  

axes_1 = plt.subplot(G[0,0:2])

axes_2 = plt.subplot(G[0,2],projection='polar')

formatf = 'png'
fname_output = './OUTPUT/'+fnameout
fig.savefig(fname_output+'.'+formatf,format=formatf,bbox_inches='tight')

问题是这样的。如果我以 png 格式绘图,我完全没有问题。但是,如果我尝试以 pdf 格式绘图。我收到以下错误:

KeyError: b'tcrm2488'

如果我在标准坐标系 x-y 中绘图或删除“乳胶”格式,我都没有问题。

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)