繪圖類型#

Matplotlib 提供的許多常見繪圖指令概觀。

請參閱圖庫以取得更多範例,以及教學頁面以取得更長的範例。

成對資料#

成對\((x, y)\)、表格\((var\_0, \cdots, var\_n)\)和函數\(f(x)=y\)資料的繪圖。

plot(x, y)

plot(x, y)

scatter(x, y)

scatter(x, y)

bar(x, height)

bar(x, height)

stem(x, y)

stem(x, y)

fill_between(x, y1, y2)

fill_between(x, y1, y2)

stackplot(x, y)

stackplot(x, y)

stairs(values)

stairs(values)

統計分佈#

資料集中至少一個變數分佈的繪圖。 其中一些方法也會計算分佈。

hist(x)

hist(x)

boxplot(X)

boxplot(X)

errorbar(x, y, yerr, xerr)

errorbar(x, y, yerr, xerr)

violinplot(D)

violinplot(D)

eventplot(D)

eventplot(D)

hist2d(x, y)

hist2d(x, y)

hexbin(x, y, C)

hexbin(x, y, C)

pie(x)

pie(x)

ecdf(x)

ecdf(x)

網格資料#

規則網格上的陣列和影像\(Z_{i, j}\)以及欄位\(U_{i, j}, V_{i, j}\)的繪圖,以及對應的座標網格\(X_{i,j}, Y_{i,j}\)

imshow(Z)

imshow(Z)

pcolormesh(X, Y, Z)

pcolormesh(X, Y, Z)

contour(X, Y, Z)

contour(X, Y, Z)

contourf(X, Y, Z)

contourf(X, Y, Z)

barbs(X, Y, U, V)

barbs(X, Y, U, V)

quiver(X, Y, U, V)

quiver(X, Y, U, V)

streamplot(X, Y, U, V)

streamplot(X, Y, U, V)

不規則網格資料#

非結構化網格上的資料\(Z_{x, y}\)、非結構化座標網格\((x, y)\)和 2D 函數\(f(x, y) = z\)的繪圖。

tricontour(x, y, z)

tricontour(x, y, z)

tricontourf(x, y, z)

tricontourf(x, y, z)

tripcolor(x, y, z)

tripcolor(x, y, z)

triplot(x, y)

triplot(x, y)

3D 和體積資料#

使用mpl_toolkits.mplot3d函式庫的三維\((x,y,z)\)、曲面\(f(x,y)=z\)和體積\(V_{x, y, z}\)資料的繪圖。

bar3d(x, y, z, dx, dy, dz)

bar3d(x, y, z, dx, dy, dz)

fill_between(x1, y1, z1, x2, y2, z2)

fill_between(x1, y1, z1, x2, y2, z2)

plot(xs, ys, zs)

plot(xs, ys, zs)

quiver(X, Y, Z, U, V, W)

quiver(X, Y, Z, U, V, W)

scatter(xs, ys, zs)

scatter(xs, ys, zs)

stem(x, y, z)

stem(x, y, z)

plot_surface(X, Y, Z)

plot_surface(X, Y, Z)

plot_trisurf(x, y, z)

plot_trisurf(x, y, z)

voxels([x, y, z], filled)

voxels([x, y, z], filled)

plot_wireframe(X, Y, Z)

plot_wireframe(X, Y, Z)

由 Sphinx-Gallery 產生圖庫