1

While plotting a list in pylab or mplot3d (2d or 3d scatter plot), is it possible to use the index in the list as marker? Or other ways (or other libraries) that can make the viewer understand which point in the list corresponds to which point on the graph.

I've included a 3d scatter plot here just for reference. I was hoping to change the blue dot marker to the index in the list. 3d scatter plot

4

1 回答 1

2

当然,您只需要plot为每个点单独调用。

但是,因为每个点都有不同的标记,所以渲染速度会很慢。如果你有几千个点,这可能是个坏主意。但是,到那时,无论如何,您将无法看到这些数字。

举个例子:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

num = 30
t = np.linspace(0, 10*np.pi, num)
x, y = np.cos(t), np.sin(t)

fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
for i in range(num):
    ax.plot([x[i]], [y[i]], [t[i]], marker='${}$'.format(i),
            markersize=12, color='black')
plt.show()

在此处输入图像描述

于 2014-03-21T20:42:32.730 回答