Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
QuLogic merged 1 commit intomatplotlib:mainfromanntzer:aatoxy
Jan 7, 2023

Conversation

anntzer
Copy link
Contributor

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 likeverts = [0, 0]; verts[self.nth_coord] = value where the mutation doesn't really help
legibility. Instead, introduce a_to_xy helper that allows writing
to_xy(variable=x, fixed=0).

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@@ -225,8 +237,7 @@ def get_tick_iterators(self, axes):

def _f(locs, labels):
for x, l in zip(locs, labels):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Optional, but

Suggested change
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).

Copy link
ContributorAuthor

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Optional as above:

Suggested change
forx,linzip(locs,labels):
forloc,labelinzip(locs,labels):

Copy link
Member

@QuLogicQuLogic left a 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.

@anntzer
Copy link
ContributorAuthor

This appears to make a different Path for loc='right', nth_coord=0 and loc='top', nth_coord=1.

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).

@anntzer
Copy link
ContributorAuthor

@QuLogic thoughts about my reply above?

@anntzer
Copy link
ContributorAuthor

Re-ping@QuLogic per my reply to#22314 (review).

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)``.
@QuLogic
Copy link
Member

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).

Yes, I'm thinking we should probably start erroring for weird inconsistent input, but that can go in a separate PR.

@QuLogicQuLogic merged commit8dd1058 intomatplotlib:mainJan 7, 2023
@anntzeranntzer deleted the aatoxy branchJanuary 7, 2023 10:31
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@QuLogicQuLogicQuLogic approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.7.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@QuLogic@tacaswell@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp