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

Skip to content

DOC: use markers as slanted breaks in broken axis example #15928

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

Conversation

ImportanceOfBeingErnest
Copy link
Member

PR Summary

The broken axis example should use markers for the slanted lines that denote the "axis break" instead of lines. This will make the example usable independent on the actual axis size; e.g. if the break does not occur in the middle of the axis.

(The problem was initially brought up in this Stackoverflow issue)

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 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

@anntzer
Copy link
Contributor

anntzer commented Dec 13, 2019

Either slanted markers, or Line2D with transform=IdentityTransform() (... plus some translation) to be in pixel space, I guess.
Edit: actually markers seem to be the right tool for this.

ax2.plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs) # bottom-right diagonal
d = .5 # proportion of vertical to horizontal extent of the slanted line
kwargs = dict(marker=[(-1, -d), (1, d)], markersize=12,
linestyle="none", color='k', mec='k', mew=1, clip_on=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps use mew=rcParams["axes.linewidth"] here? 1 looks a bit thick (the rc value is 0.8).

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately the default of 0.8 looks not so nice when not being straight (for the default dpi and pixel output)

image

Hence I chose to keep 1.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

I actually think 0.8 looks better than 1 (hence the suggestion) but am fine with your choice too.

Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

Just one small point, take it or leave it, can self-merge after that.

@ImportanceOfBeingErnest
Copy link
Member Author

I'm not currently up to date as to which branch documentation should go to. So maybe someone who knows can merge.

@anntzer anntzer added this to the v3.3.0 milestone Dec 13, 2019
@anntzer
Copy link
Contributor

anntzer commented Dec 13, 2019

recent doc prs were milestoned as 3.3, so let's put this here too.

@anntzer anntzer merged commit 741b140 into matplotlib:master Dec 13, 2019
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.

2 participants