【发布时间】:2020-09-24 10:22:12
【问题描述】:
我在 3 维框架中散布点;你怎么可能通过段(或向量)将这些点中的每一个连接到框架的中心(0,0,0)? 这是使用的代码:
from numpy import random
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
N = 10
coords = random.normal(loc = 0, scale = 1, size = (N, 3))
x = coords[:, 0]
y = coords[:, 1]
z = coords[:, 2]
fig = plt.figure(figsize=(12,12))
ax = plt.axes(projection ="3d")
ax.scatter3D(x, y, z, color = "green", s = 300)
这是得到的情节:
我想得到的是:
【问题讨论】:
标签: python-3.x matplotlib scatter-plot