Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve Conectionstyle Demo #13835

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

Merged
merged 1 commit into from
Apr 10, 2019
Merged

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Apr 1, 2019

PR Summary

  • Add introductory description.
  • Cleanup code.
  • Add references.

@ImportanceOfBeingErnest
Copy link
Member

I noticed that the current version on master lost the right spines

image

while in the current online docs

image

In case this change is expected (might actually be due to #12716 ), I'd suggest to modify fig.tight_layout(pad=0) to fig.tight_layout(pad=1) or whatever is needed to have the complete axis drawn.

@timhoffm timhoffm force-pushed the doc-connecteionstyle branch from 302a776 to 83acb12 Compare April 2, 2019 06:07
@timhoffm
Copy link
Member Author

timhoffm commented Apr 2, 2019

Even with fig.tight_layout(pad=0) the axes frame should be drawn completely. I consider this a bug in margin calculation. It should be fixed and not worked around in the example. Attn. @jklymak

@ImportanceOfBeingErnest
Copy link
Member

I don't think this is a bug in the margin calculation. It's more that now that the axes extent is calculated correctly you see the same as you would see in a case where you have the axes span the entire figure:

import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (3,2)

fig, ax = plt.subplots()
fig.subplots_adjust(0,0,1,1)

plt.savefig("test.png")

test

So the underlying question is: Would a line that is at the edge of the figure need to be stamped to pixels by a different set of rules than other lines within the figure?

Since I don't expect there to an answer to this in the short term, my suggestion would still be to increase the padding for this example such that it looks good. After all, pad=0 is not relevant for the example and is chosen pretty arbitrarily.

@jklymak
Copy link
Member

jklymak commented Apr 2, 2019

@timhoffm the bbox calculation is correct. As @ImportanceOfBeingErnest says, the pixel stamping is putting the line on either side of that bbox depending on how many pixels are in the figure. I don’t think there is anything the bbox calculation that can take that into account because it is backend dependent.

That this “worked” before was because the axes bbox returned a random margin around the axes. I’d be against going back to that buggy implementation, and agree that adding a small pad is the way to fix this problem.

@timhoffm timhoffm force-pushed the doc-connecteionstyle branch from 83acb12 to 667b23e Compare April 2, 2019 20:20
@timhoffm
Copy link
Member Author

timhoffm commented Apr 2, 2019

Ok, added a small padding.

@timhoffm timhoffm force-pushed the doc-connecteionstyle branch from 667b23e to a313f6e Compare April 2, 2019 20:23
Copy link
Member

@ImportanceOfBeingErnest ImportanceOfBeingErnest left a comment

Choose a reason for hiding this comment

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

This looks good. I will not merge since there are test failures I do not understand.
Also, does this need a milestone?

@timhoffm
Copy link
Member Author

timhoffm commented Apr 2, 2019

Appveyor py37 is failing for some time with lib\matplotlib\mathtext.py:628: MemoryError. I'm unclear if their install is broken or if it's coming from mpl code.

Anyway, it's unrelated to this PR.

Yes, it needs a milestone: Canonically, it would be 3.1.1, but simple doc backports are still accepted for 3.1.0. I'm not setting this to 3.1.0 to not hold up 3.1.0 with open PRs. But whoever merges this before 3.1.0 is out, can set that milestone before merging.

@timhoffm timhoffm force-pushed the doc-connecteionstyle branch from a313f6e to e7d0fbe Compare April 9, 2019 21:45
@anntzer anntzer modified the milestones: v3.1-doc, v3.1.0 Apr 10, 2019
@anntzer anntzer merged commit e75c0e7 into matplotlib:master Apr 10, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Apr 10, 2019
dstansby added a commit that referenced this pull request Apr 10, 2019
…835-on-v3.1.x

Backport PR #13835 on branch v3.1.x (Improve Conectionstyle Demo)
@timhoffm timhoffm deleted the doc-connecteionstyle branch April 10, 2019 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants