lorenz_attractor
洛伦兹吸引力这是使用mplot3d在3维空间中绘制Edward Lorenz 1963年的“确定性非周期流”的示例。 注意:因为这是一个简单的非线性ODE,使用SciPy的ode求解器会更容易完成,但这种方法仅取决于NumPy。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152import numpy as npimport matplotlib.pyplot as plt# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importdef lorenz(x, y, z, s=10, r=28, b=2.667): ''' Given: x, y, z: a point of int...
pathpatch3d
在3D绘图中绘制平面对象演示如何使用pathpatch_2d_to_3d在3D绘图上“绘制”形状和文本。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.patches import Circle, PathPatchfrom matplotlib.text import TextPathfrom matplotlib.transforms import Affine2D# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importimport mpl_tool...
offset
自动文本偏移演示如何使用pathpatch_2d_to_3d在3D绘图上“绘制”形状和文本。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.patches import Circle, PathPatchfrom matplotlib.text import TextPathfrom matplotlib.transforms import Affine2D# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importimport mpl_toolkits.m...
polys3d
生成多边形以填充3D线图演示如何创建填充线图下空间的多边形。 在这个例子中,多边形是半透明的,产生一种“锯齿状的彩色玻璃”效果。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importfrom matplotlib.collections import PolyCollectionimport matplotlib.pyplot as pltfrom matplotlib import colors as mcolorsimport numpy as np# Fixing random state for reproducibilitynp.random.seed(1968...
quiver3d
3D箭袋图像演示在3d网格上的点处绘制方向箭头。 1234567891011121314151617181920212223# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importimport matplotlib.pyplot as pltimport numpy as npfig = plt.figure()ax = fig.gca(projection='3d')# Make the gridx, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2), np.arange(-0.8, 1, 0.2), np.arange(-0.8, 1, 0.8))# Make the direction data for the arrowsu...
rotate_axes3d_sgskip
旋转3D绘图一个非常简单的旋转3D绘图动画。 有关动画3D绘图的另一个简单示例,请参阅wire3d_animation_demo。 (构建文档库时会跳过此示例,因为它有意运行需要很长时间) 123456789101112131415from mpl_toolkits.mplot3d import axes3dimport matplotlib.pyplot as pltfig = plt.figure()ax = fig.add_subplot(111, projection='3d')# load some test data for demonstration and plot a wireframeX, Y, Z = axes3d.get_test_data(0.1)ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5)# rotate the axes and updatefor angle in range(0, 360): ax.view_init(30, angle) plt.draw() ...
scatter3d
3D散点图演示3D中的基本散点图。 1234567891011121314151617181920212223242526272829303132333435# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importimport matplotlib.pyplot as pltimport numpy as np# Fixing random state for reproducibilitynp.random.seed(19680801)def randrange(n, vmin, vmax): ''' Helper function to make an array of random numbers having shape (n, ) with each number distributed Uniform(vmin...
subplot3d
3D绘图作为子图展示包括3D图作为子图。 12345678910111213141516171819202122232425262728293031323334353637383940import matplotlib.pyplot as pltfrom matplotlib import cmimport numpy as npfrom mpl_toolkits.mplot3d.axes3d import get_test_data# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import# set up a figure twice as wide as it is tallfig = plt.figure(figsize=plt.figaspect(0.5))#===============# First subplot#===============# set ...
surface3d
三维曲面(颜色贴图)演示绘制使用coolwarm颜色贴图着色的3D表面。 使用antialiased = False使表面变得不透明。 还演示了使用LinearLocator和z轴刻度标签的自定义格式。 1234567891011121314151617181920212223242526272829303132# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importimport matplotlib.pyplot as pltfrom matplotlib import cmfrom matplotlib.ticker import LinearLocator, FormatStrFormatterimport numpy as npfig = plt.figure()ax = fig.gca(projection='3d')# Make...
surface3d_2
三维曲面(纯色)使用纯色演示3D表面的基本图。 123456789101112131415161718192021# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importimport matplotlib.pyplot as pltimport numpy as npfig = plt.figure()ax = fig.add_subplot(111, projection='3d')# Make datau = np.linspace(0, 2 * np.pi, 100)v = np.linspace(0, np.pi, 100)x = 10 * np.outer(np.cos(u), np.sin(v))y = 10 * np.outer(np.sin(u), np.sin(v))z = 10 * np.outer(np.ones(np.size...













