首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Python:未识别的乳胶

Python:未识别的乳胶
EN

Stack Overflow用户
提问于 2022-10-14 20:41:02
回答 1查看 49关注 0票数 1

我试图在matplotlib中创建一个所有标签都在LaTeX中的地块。我在Fedora 36上使用木星笔记本,使用!pip install latex安装!pip install latex。这是我的节目:

代码语言:javascript
运行
复制
# importing the required module 
import matplotlib.pyplot as plt 
    
# x axis values 
x = [1,2,3] 
# corresponding y axis values 
y = [2,4,1] 
    
# plotting the points  
plt.plot(x, y) 
    
# naming the x axis 
plt.xlabel('x - axis') 
# naming the y axis 
plt.ylabel('y - axis') 
    
# giving a title to my graph 
plt.title('My first graph!') 

plt.rcParams.update({
    "text.usetex": True,
    "font.family": "monospace"})
    
# function to show the plot 
plt.show() 

然而,我收到了这个错误:

代码语言:javascript
运行
复制
RuntimeError: Failed to process string with tex because latex could not be found

我在这里错过了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-14 22:08:41

matplotlib不依赖于python库latex;相反,它依赖于LaTeX iself。您需要安装LaTeX,请参阅乳胶::软呢帽。因为您只希望这样做来呈现matplotlib标签,所以请尝试如下:

代码语言:javascript
运行
复制
sudo dnf install texlive-scheme-basic

如果这还不够,您可以安装texlive-scheme-mediumtexlive-scheme-full

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74074659

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档