MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / ProcessPlotter

Class ProcessPlotter

galleries/examples/misc/multiprocess_sgskip.py:30–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29
30class ProcessPlotter:
31 def __init__(self):
32 self.x = []
33 self.y = []
34
35 def terminate(self):
36 plt.close('all')
37
38 def call_back(self):
39 while self.pipe.poll():
40 command = self.pipe.recv()
41 if command is None:
42 self.terminate()
43 return False
44 else:
45 self.x.append(command[0])
46 self.y.append(command[1])
47 self.ax.plot(self.x, self.y, 'ro')
48 self.fig.canvas.draw()
49 return True
50
51 def __call__(self, pipe):
52 print('starting plotter...')
53
54 self.pipe = pipe
55 self.fig, self.ax = plt.subplots()
56 timer = self.fig.canvas.new_timer(interval=1000)
57 timer.add_callback(self.call_back)
58 timer.start()
59
60 print('...done')
61 plt.show()
62
63# %%
64#

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…