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

Use SubplotSpec row/colspans more, and deprecate get_rows_columns.#16618

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:masterfromanntzer:subplotspans
Mar 25, 2020

Conversation

anntzer
Copy link
Contributor

and simplify constrained_layout by using rowspan/colspan instead.

(The deprecation was suggested in#13544 (comment).)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@QuLogic
Copy link
Member

This is pretty long to be considered just a deprecation.

@QuLogicQuLogic requested a review fromjklymakMarch 12, 2020 01:31
Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

Overall using the colspan and rowspan is nicer than what was being done before and helpful. There was one block in there where@anntzer had to obfuscate a relatively straightforward piece of code to the point that I can't really tell what it does for very little savings IMHO.

pos, ax = pos_ax
return pos

minrow, minrow_ax = min(
Copy link
Member

Choose a reason for hiding this comment

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

This code block is pretty obfuscated compared to the original.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

fair enough, went for some compromise...

@anntzer
Copy link
ContributorAuthor

@QuLogic fair enough (though replacing get_rows_columns() everywhere is necessarily going to involve quite a few changes), do you have a suggested path forward here?

if location == 'right':
if col_stop <= maxcol:
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@jklymak btw, are you really sure about whether the various inequalities here must be >/< or >=/<=? I'm not 100% sure they're all correct, and a comment explaining strict vs non-strict equalities may help...

Copy link
Member

Choose a reason for hiding this comment

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

Well, you are the one who decided it should all be off by one, so I assumed you carefully checked ;-) It passes the tests so that is encouraging. There are lots of quite complex tests, so its hard to see how you broke something if it passes.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I actually was referring to the original version.

Copy link
Member

Choose a reason for hiding this comment

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

ha ha, OK. But again, the tests are pretty complex and don't fail in any weird ways. If these inequalities were not correct, its a little hard to see how the whole thing would work. But I can go through and try and remember why each is the way it is.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I was slightly puzzled by them, so if you can add a comment that would be nice, but there's no urgency whatsoever.

Copy link
Member

Choose a reason for hiding this comment

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

These are all correct. Lets say the parents of the colorbar span columns 1-3 of a six column layout (indexed 0, 1, 2, 3, 4, 5).maxrow is then 3. If a subplot span stops at 3 or less then the colorbar is to the right (I assume in this case thatsubspec.colspan.stop == 4). If the subplotstarts 4 or higher the colorbar is to its left.

Note its entirely possible for a subplot to not be positioned relative to the colorbar. i.e. if in another row it spans columns 0-5 that is perfectly allowed and neither stacking would happen. Saying that I wonder if Ido have a bug in here where I should only callhstack if order is not empty. But maybe this should go in first and I fix things like that.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Hmm, I guess I'll just trust you on this for now and leave things as they are (with the mechanical translation) ;)

Copy link
Member

Choose a reason for hiding this comment

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

I think thats fine, but I will go through and fix this after your translation is in.

@QuLogic
Copy link
Member

QuLogic commentedMar 12, 2020
edited
Loading

@QuLogic fair enough (though replacing get_rows_columns() everywhere is necessarily going to involve quite a few changes), do you have a suggested path forward here?

Just don't call it (the PR) a deprecation ;) The deprecation is a side effect of the re-factor, even if it may have been its initial cause.

@anntzeranntzer changed the titleDeprecate SubplotSpec.get_rows_columns.Use SubplotSpec row/colspans more, and deprecate get_rows_columns.Mar 12, 2020
@anntzer
Copy link
ContributorAuthor

fair enough, edited the commit message :)

height1 = heights[idx1]
# Horizontally align axes spines if they have the same min or max:
if not alignleft and colspan0.start == colspan1.start:
_log.debug('same start columns; line up layoutbox lefts')
Copy link
Member

Choose a reason for hiding this comment

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

Bit weird these debug messages, because they never mention whichax0 orax1 they're talking about.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I assume these were intended to help debug the original implementation in simple cases where it's "clear" which axes are involved...

@anntzer
Copy link
ContributorAuthor

rebased

@QuLogic
Copy link
Member

Tests fail due to removed imports.

@QuLogic
Copy link
Member

#16897

@QuLogicQuLogic reopened thisMar 24, 2020
@QuLogicQuLogic merged commitce9c860 intomatplotlib:masterMar 25, 2020
@anntzeranntzer deleted the subplotspans branchMarch 25, 2020 07:32
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@QuLogicQuLogicQuLogic approved these changes

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

Successfully merging this pull request may close these issues.

3 participants
@anntzer@QuLogic@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp