Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add a helper to generate xy coordinates for AxisArtistHelper.#22314
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
@@ -225,8 +237,7 @@ def get_tick_iterators(self, axes): | |||
def _f(locs, labels): | |||
for x, l in zip(locs, labels): |
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.
Optional, but
forx,linzip(locs,labels): | |
forloc,labelinzip(locs,labels): |
would be a bit clearer. inself._to_xy(x, const=self._pos)
x can be a y-coordinate depending onself._pos
, so better useself._to_xy(loc, const=self._pos)
.
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.
sure
@@ -298,8 +303,7 @@ def get_tick_iterators(self, axes): | |||
def _f(locs, labels): | |||
for x, l in zip(locs, labels): |
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.
Optional as above:
forx,linzip(locs,labels): | |
forloc,labelinzip(locs,labels): |
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.
This appears to make a differentPath
forloc='right', nth_coord=0
andloc='top', nth_coord=1
.
Uh oh!
There was an error while loading.Please reload this page.
True, but does a "right x-axis" or a "top y-axis" even make sense? (to be clear, previously a right x-axis would be a 0-1 x-axis at y=0 and now it's at y=1) If anything we should just make these error out (which I can do as part of this PR or of a followup). |
@QuLogic thoughts about my reply above? |
Re-ping@QuLogic per my reply to#22314 (review). |
Uh oh!
There was an error while loading.Please reload this page.
AxisArtistHelper can generate either x or y ticks/gridlines dependingon the value of self.nth_coord. The implementation often requiresgenerating e.g. shape (2,) arrays such that the nth_coord column isset to a tick position, and the 1-nth_coord column has is set to0. This is currently done using constructs like ``verts = [0, 0];verts[self.nth_coord] = value`` where the mutation doesn't really helplegibility. Instead, introduce a ``_to_xy`` helper that allows writing``to_xy(variable=x, fixed=0)``.
Yes, I'm thinking we should probably start erroring for weird inconsistent input, but that can go in a separate PR. |
AxisArtistHelper can generate either x or y ticks/gridlines depending
on the value of self.nth_coord. The implementation often requires
generating e.g. shape (2,) arrays such that the nth_coord column is
set to a tick position, and the 1-nth_coord column has is set to
0. This is currently done using constructs like
verts = [0, 0]; verts[self.nth_coord] = value
where the mutation doesn't really helplegibility. Instead, introduce a
_to_xy
helper that allows writingto_xy(variable=x, fixed=0)
.PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).