Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add get_segments method to collections.LineCollection #1655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,16 @@ def set_segments(self, segments):
set_verts = set_segments # for compatibility with PolyCollection
set_paths = set_segments

def get_segments(self):
segments = []

for path in self._paths:
vertices = [vertex for vertex, _ in path.iter_segments()]
vertices = np.asarray(vertices)
segments.append(vertices)

return segments

def _add_offsets(self, segs):
offsets = self._uniform_offsets
Nsegs = len(segs)
Expand Down