简体   繁体   English

matplotlib无法使用usetex = True输出EPS数字

[英]matplotlib fails to output EPS figure with usetex = True

I am trying to output ( savefig ) matplotlib figures as EPS; 我试图将( savefig )matplotlib数字输出为EPS; however, it seems there is a conflict when using the LaTeX rendering AND saving EPS figures. 但是,使用LaTeX渲染并保存EPS数据时似乎存在冲突。 For example, the following code produces a good EPS figure: 例如,以下代码可产生良好的 EPS值:

import matplotlib.pyplot as plt
import numpy as np

plt.figure()
plt.plot(np.random.rand(100))
plt.savefig('plot.eps')

whereas this code produces an EPS figure that can not be viewed; 而此代码产生的EPS数字无法查看; my document viewer (Ubuntu's Evince) continuously says "Loading..." 我的文档查看器(Ubuntu的Evince)连续说“正在加载...”

import matplotlib.pyplot as plt
import numpy as np

plt.rc('text', usetex = True)
plt.figure()
plt.plot(np.random.rand(100))
plt.savefig('plot.eps')

Is there a known issue when combining these two options? 结合这两个选项时是否存在已知问题? Is there any kind of work around (aside from saving as PDF or saving as PDF then converting to EPS)? 是否有其他解决方法(除了另存为PDF或另存为PDF然后转换为EPS)?

The only solution I could find was to update matplotlib from 1.2.1 to 1.3.1. 我能找到的唯一解决方案是将matplotlib从1.2.1更新到1.3.1。 Now it works without problems. 现在它可以正常工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 text.usetex 时,无法在 Windows 中将 matplotlib 图保存到 .eps :True - Can´t save matplotlib figure to .eps in Windows while using text.usetex : True 使用MatPlotlib和LaTex文本渲染(usetex)创建.eps输出时出错 - Error creating .eps output with matplotlib with LaTex text rendering (usetex) matplotlib rc('text',usetex = True)产生错误 - matplotlib rc('text', usetex=True) producing errors 设置“matplotlib.rcParams['text.usetex'] = True”以在标签中使用LaTeX并使用德语语言环境使用逗号时的Python图形问题 - Python figure problem when setting "matplotlib.rcParams['text.usetex'] = True" to use LaTeX in labels AND using the German locale to use the comma Matplotlib在text.usetex == True时不使用乳胶字体 - Matplotlib not using latex font while text.usetex==True text.usetex的好处是什么:在matplotlib中为True - What's the benefit of text.usetex : True in matplotlib 如何在Matplotlib中将rc param`usetex = True`与其他字体一起使用 - How to use rc param `usetex=True` with other fonts in matplotlib 在Python Matplotlib中将图形另存为eps时出错 - Error when saving figure as eps in Python Matplotlib 减少使用matplotlib制作的.eps图形的大小 - Reduce the size of .eps figure made using matplotlib 使用matplotlib导出pdf时找不到字体使用usetex = True的Agg后端 - Can not find fonts when export pdf using matplotlib Agg backend with usetex=True
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM