Python Matplotlib:着色 3D 散点图

Python Matplotlib: Shading 3D Scatter Plot

我有一个 3D 点云的散点图(见图)。绿色的点实际上形成了星形的挤压,蓝色的是五边形等,但这很难看到。所以我想要一些 "shading" 的点云。可以对曲面执行此类操作(如讨论的 here:

我目前拥有的代码:

import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()  # for plot styling

filename = sys.argv[1]
# flow_events = np.loadtxt(filename, comments='#')
flow_events = pd.read_csv(filename, delimiter = "\t", skiprows=1, names=["event_x", "event_y", "event_ts", "event_label"])
n_flow_events = flow_events.values

# start = int(n_flow_events.shape[0]/3.0)
end = int(n_flow_events.shape[0]/10.0*7)
start = 0
# end = n_flow_events.shape[0]

events = n_flow_events[start:end, :]

number_to_display = 5
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(events[0::number_to_display, 0], events[0::number_to_display, 1], events[0::number_to_display, 2], c=(events[0::number_to_display, 3]+4), s=4, cmap=plt.cm.brg)

ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('time [s]')

plt.show()

所以这并不是我提出的问题的确切解决方案,但我最终按照 mauve 的建议做了: