我偶尔会看到这样的图示,即在3D空间中将两个二维散点图叠加在一起,以便将对应点连接起来。通常它们采用网络形式,其中两个网络叠加在一起。例如:
参考:https://satijalab.org/seurat/v3.0/pbmc3k_tutorial.html
参考资料: https://image.slidesharecdn.com/2007mauricioarango-end-to-endqosviaoverlaynetworksandbandwidthon-demand-091102230540-phpapp02/95/providing-endtoend-network-qos-via-overlay-networks-and-bandwidth-ondemand-mauricio-arango-2007-5-728.jpg?cb=1257203157
我知道,我可以任意地添加一个共同的第三维度到二维图中,以获得如此的绘图:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
def randrange(n, vmin, vmax):
return (vmax - vmin)*np.random.rand(n) + vmin
n = 100
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
xs = randrange(n, 23, 32)
ys = randrange(n, 0, 100)
zs = np.append(np.repeat(1, 50), np.repeat(2, 50))
for c, m in [('r', 'o'), ('b', '^')]:
ax.scatter(xs, ys, zs, c=c, marker = m)
然后连接相关点,但我认为在R或Python中构建这样的图像可能有更直接的方法?
randrange()
函数。 - G_T