matplotlib を使用して 3D 散布図を作成していますが、3 つの軸すべてに共通の原点を持つ図を作成できません。これどうやってするの?
私のコード(これまでのところ)、私はPythonに非常に慣れていないため、軸仕様の定義を実装していません:
from mpl_toolkits.mplot3d.axes3d import Axes3D
import matplotlib.pyplot as plt
# imports specific to the plots in this example
import numpy as np
from matplotlib import cm
from mpl_toolkits.mplot3d.axes3d import get_test_data
def randrange(n, vmin, vmax):
return (vmax-vmin)*np.random.rand(n) + vmin
# Same as wide as it is tall.
fig = plt.figure(figsize=plt.figaspect(1.0))
ax = fig.add_subplot(111, projection='3d')
n = 512
xs = np.random.randint(0, 10, size=n)
ys = np.random.randint(0, 10, size=n)
zs = np.random.randint(0, 10, size=n)
colors = np.random.randint(0, 10, size=n)
scat = ax.scatter(xs, ys, zs, c=colors, marker='o')
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
fig.colorbar(scat, shrink=0.5, aspect=10)
plt.show()