首页 > 解决方案 > 为什么 Jupyter notebook 在 matplotlib xlabel() 之后会打印文本?

问题描述

MWE:

import matplotlib.pyplot as plt
import numpy as np

x = np.random.rand(100)
y = np.random.rand(100)

plt.scatter(x, y)
plt.xlabel('x')

输出:

在此处输入图像描述

为什么会显示Text(0.5, 0, 'x'),我该如何抑制它?

我怀疑它是xlabel()函数的输出,但我在文档中没有看到任何关于返回值的信息。

标签: pythonmatplotlibaxes

解决方案


推荐阅读