MCPcopy Index your code
hub / github.com/PiLiDAR/PiLiDAR / update

Method update

lib/matplotlib_2D.py:51–67  ·  view source on GitHub ↗
(self, points_2d)

Source from the content-addressed store, hash-verified

49 # plt.pause(self.pause)
50
51 def update(self, points_2d): # points_2d: np.array([[x, y, luminance], ...])
52 line = getattr(self, 'line', None)
53 if line is not None:
54 line.remove()
55
56 self.x_list = points_2d[:, 0]
57 self.y_list = points_2d[:, 1]
58 self.color_list = self.__gray2rgb__(points_2d[:, 2])
59
60 self.line = self.ax.scatter(self.x_list, self.y_list, c=self.color_list/255, s=self.s)
61
62 # # Set the plot range based on the maximum absolute value in x_list and y_list
63 # self.plotrange = max(max(abs(self.x_list)), max(abs(self.y_list)))
64 # self.ax.set_xlim([-self.plotrange, self.plotrange])
65 # self.ax.set_ylim([-self.plotrange, self.plotrange])
66
67 plt.pause(self.pause)
68
69 def close(self):
70 plt.close()

Callers 2

read_loopMethod · 0.80
matplotlib_2D.pyFile · 0.80

Calls 1

__gray2rgb__Method · 0.95

Tested by

no test coverage detected