如何解决matplotlib 用极坐标绘制 pdf 错误
我想绘制并保存为 pdf:
这是我目前所做的:
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 举报,一经查实,本站将立刻删除。