Bases: object
Manage the callbacks to maintain a list of selected vertices for Line2D
. Derived classes should override the process_selected
method to do something with the picks.
Here is an example which highlights the selected verts with red circles:
import numpy as np import matplotlib.pyplot as plt import matplotlib.lines as lines class HighlightSelected(lines.VertexSelector): def __init__(self, line, fmt='ro', **kwargs): super().__init__(line) self.markers, = self.axes.plot([], [], fmt, **kwargs) def process_selected(self, ind, xs, ys): self.markers.set_data(xs, ys) self.canvas.draw() fig, ax = plt.subplots() x, y = np.random.rand(2, 30) line, = ax.plot(x, y, 'bs-', picker=5) selector = HighlightSelected(line) plt.show()
Line2D
The line must already have been added to an Axes
and must have its picker property set.
When the line is picked, update the set of selected indices.
Default "do nothing" implementation of the process_selected
method.
The indices of the selected vertices.
The coordinates of the selected vertices.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4