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

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

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

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

matplotlib.axes.Axes.fill()函数

matplotlib 库的 axes 模块中的Axes.fill()函数用于绘制填充的多边形。

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

示例 1:

Axes.fill(self, *args, data=None, **kwargs)

输出:

示例 2:

# Implementation of matplotlib function
       
import numpy as np
from matplotlib import patches
import matplotlib.pyplot as plt
   
x = np.array([1, 4, 1, 4])
y = np.array([1, 1, 4, 4])
  
fig, ax1 = plt.subplots()
ax1.fill(x, y, facecolor ='green')
ax1.set_title('matplotlib.axes.Axes.fill Example 1')
plt.show()

输出: