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
add get_segments method to collections.LineCollection - updated #1645
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1008,6 +1008,19 @@ 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 | ||
|
||
get_verts = get_segments | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this needs to be considered, strictly speaking you're not getting the vertices, you're getting the paths. I appreciate that there is a setter defined further up which allows you to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Wed, Jan 9, 2013 at 11:49 AM, Phil Elson notifications@github.comwrote:
Yes, you are right, I should have added that comment. I don't know why I |
||
get_paths = get_segments | ||
|
||
def _add_offsets(self, segs): | ||
offsets = self._uniform_offsets | ||
Nsegs = len(segs) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no real benefit to prefixing these variables with an underscore (they are out of scope in all but this method). Would you mind de-underscoring them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Wed, Jan 9, 2013 at 11:47 AM, Phil Elson notifications@github.comwrote:
I would not mind at all. However, I was trying to keep the same variable
naming scheme as set_segments. Either way is fine with me.