import matplotlib.pyplot as plt
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker import MaxNLocator
import numpy as np
Z = np.random.rand(6, 10)
x = np.arange(-0.5, 10, 1) # len = 11
y = np.arange(4.5, 11, 1) # len = 7
Z.shape # 四边形的色彩值
(6, 10)
x.shape # 四边形的边缘横坐标(比Z多1维,官方不推荐x与Z相同)
(11,)
y.shape # 四边形的边缘纵坐标(比Z多1维,官方不推荐y与Z相同)
(7,)
fig, ax = plt.subplots()
ax.pcolormesh(x, y, Z)