| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -8,7 +8,7 @@ | |
| import matplotlib.axis as maxis | ||
| import matplotlib.markers as mmarkers | ||
| import matplotlib.patches as mpatches | ||
| import matplotlib.path as mpath | ||
| from matplotlib.path import Path | ||
| import matplotlib.ticker as mticker | ||
| import matplotlib.transforms as mtransforms | ||
| import matplotlib.spines as mspines | ||
| Expand Down Expand Up | @@ -50,11 +50,57 @@ def transform_non_affine(self, tr): | |
|
|
||
| def transform_path_non_affine(self, path): | ||
| # docstring inherited | ||
| vertices = path.vertices | ||
| if len(vertices) == 2 and vertices[0, 0] == vertices[1, 0]: | ||
| return mpath.Path(self.transform(vertices), path.codes) | ||
| ipath = path.interpolated(path._interpolation_steps) | ||
| return mpath.Path(self.transform(ipath.vertices), ipath.codes) | ||
| if not len(path) or path._interpolation_steps == 1: | ||
| return Path(self.transform_non_affine(path.vertices), path.codes) | ||
| xys = [] | ||
| codes = [] | ||
| last_t = last_r = None | ||
| for trs, c in path.iter_segments(): | ||
| trs = trs.reshape((-1, 2)) | ||
| if c == Path.LINETO: | ||
| (t, r), = trs | ||
| if t == last_t: # Same angle: draw a straight line. | ||
| xys.extend(self.transform_non_affine(trs)) | ||
| codes.append(Path.LINETO) | ||
| elif r == last_r: # Same radius: draw an arc. | ||
| # The following is complicated by Path.arc() being | ||
| # "helpful" and unwrapping the angles, but we don't want | ||
| # that behavior here. | ||
| last_td, td = np.rad2deg([last_t, t]) | ||
| if self._use_rmin and self._axis is not None: | ||
| r = ((r - self._axis.get_rorigin()) | ||
| * self._axis.get_rsign()) | ||
| if last_td <= td: | ||
| while td - last_td > 360: | ||
| arc = Path.arc(last_td, last_td + 360) | ||
| xys.extend(arc.vertices[1:] * r) | ||
| codes.extend(arc.codes[1:]) | ||
| last_td += 360 | ||
| arc = Path.arc(last_td, td) | ||
| xys.extend(arc.vertices[1:] * r) | ||
| codes.extend(arc.codes[1:]) | ||
| else: | ||
| # The reverse version also relies on the fact that all | ||
| # codes but the first one are the same. | ||
| while last_td - td > 360: | ||
| arc = Path.arc(last_td - 360, last_td) | ||
|
Comment thread
Copy link
Copy Markdown
Member
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAs does this block.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitysame as above
Sorry, something went wrong.
All reactions
|
||
| xys.extend(arc.vertices[::-1][1:] * r) | ||
| codes.extend(arc.codes[1:]) | ||
| last_td -= 360 | ||
| arc = Path.arc(td, last_td) | ||
| xys.extend(arc.vertices[::-1][1:] * r) | ||
| codes.extend(arc.codes[1:]) | ||
| else: # Interpolate. | ||
| trs = cbook.simple_linear_interpolation( | ||
|
Comment thread
Copy link
Copy Markdown
Member
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAnd this block too.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitytest added
Sorry, something went wrong.
All reactions
|
||
| np.row_stack([(last_t, last_r), trs]), | ||
| path._interpolation_steps)[1:] | ||
| xys.extend(self.transform_non_affine(trs)) | ||
| codes.extend([Path.LINETO] * len(trs)) | ||
| else: # Not a straight line. | ||
| xys.extend(self.transform_non_affine(trs)) | ||
| codes.extend([c] * len(trs)) | ||
| last_t, last_r = trs[-1] | ||
| return Path(xys, codes) | ||
|
|
||
| def inverted(self): | ||
| # docstring inherited | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis block seems untested.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitytest added, although it's not particularly interesting (I can't actually think of a very interesting test for that...)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.