我有一个3D点云的散点图(请参见图片)。绿点实际上是星形的挤出物,蓝是五边形等,但这很难看到。因此,我想对点云进行一些“阴影处理”。可以对曲面执行此类操作(例如讨论过的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()