python - 如何在 matplotlib(python) 中为轴添加标题和标签?

标签 python matplotlib

我试图使它像这样,但它说没有对象属性标题

import matplotlib
matplotlib.use('Svg')
from pylab import *
clf()
tittle("frequency of words")
xlabel("words")
ylabel("frequency")

最佳答案

您需要先创建一个图形,然后才能设置其标题:

figure()
title('frequency of words')

关于python - 如何在 matplotlib(python) 中为轴添加标题和标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16480701/

相关文章:

python - 如何从文件中绘制多条垂直线?

Python Seaborn 图表 - 阴影区域

python - Django Forms - 保存后重定向

python - 使用 rpy2 更改 ggplot2 中的图例

python - 是否有一个内置的“apply”函数(如“lambda f:f()”),就像Python 2中那样?

python - 如何在 Seaborn 或 Matplotplib 中制作组颜色条 xticks yticks

python - 带有两个 y 尺度的 Seaborn despine (twinx)

python - Matplotlib:在创建轮廓后绘制一个轴的轮廓

python - QueryFrame 在 Windows 上非常慢

python - 我存储了刷新 token ,如何使用它来刷新我的访问 token