📜  Python中的 Matplotlib.axes.Axes.text()

📅  最后修改于: 2022-05-13 01:54:58.850000             🧑  作者: Mango

Python中的 Matplotlib.axes.Axes.text()

Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。 Axes 类包含大部分图形元素:Axis、Tick、Line2D、Text、Polygon 等,并设置坐标系。 Axes 的实例通过回调属性支持回调。

matplotlib.axes.Axes.text()函数

matplotlib 库的 axes 模块中的Axes.text()函数也用于将文本 s 添加到数据坐标中位置 x、y 的轴上。

下面的示例说明了 matplotlib.axes 中的 matplotlib.axes.Axes.text()函数:

示例 1:

Axes.text(self, x, y, s, fontdict=None, withdash=, **kwargs)

输出:

示例 2:

# Implementation of matplotlib function
import matplotlib.pyplot as plt
  
fig, ax = plt.subplots()
ax.text(3, 4, 'GeeksforGeeks', style ='italic',
        fontsize = 30, color ="green")
  
ax.set(xlim =(0, 8), ylim =(0, 8))
ax.set_title('matplotlib.axes.Axes.text() Example',
             fontsize = 14, fontweight ='bold')
  
plt.show()

输出: