1
我想在同一图中绘制一个线框和一个散点图。以下是我所做的:同一图中的两个不同图
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax1 = fig.add_subplot(111, projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)
ax1.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
ax2 = fig.add_subplot(111, projection='3d')
xs = np.array([ 1, 0 ,2 ])
ys = np.array([ 1, 0, 2 ])
zs = np.array([ 1, 2, 3 ])
ax2.scatter(xs, ys, zs)
plt.show()
此脚本仅给出散点图。评论任何块,你会得到未注释的情节。但他们不会一起出现在同一个地方。