当使用matplotlib
'sscatter
模块在 3D 上绘制分散数据时,选项color
和的marker
行为不符合预期,例如,
color='r', marker='o'
产生被红色圆圈包围的蓝点,而不是仅填充红色圆圈。
为什么会这样?
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
N = 100
x = 0.9 * np.random.rand(N)
y = 0.9 * np.random.rand(N)
z = 0.9 * np.random.rand(N)
##### Plotting:
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.scatter(x, y, z, color='r', marker='o')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
plt.show()