Skip to content

Add explanatory comments for text rotation example #13469

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

Conversation

mollyrossow
Copy link
Contributor

PR Summary

This pull request adds explanatory text to the text rotation gallery example in response to issue #11654.

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

@@ -3,7 +3,14 @@
Demo Text Rotation Mode
=======================

The axes method text takes an argument rotation_mode that controls the
Copy link
Member

Choose a reason for hiding this comment

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

You can format the name of methods to directly link to the respective method, and format other code in monospace font, e.g.

Suggested change
The axes method text takes an argument rotation_mode that controls the
The axes' method `~.axes.Axes.text` takes an argument ``rotation_mode`` that controls the

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I'll make that change everywhere in the docstring.

@mollyrossow
Copy link
Contributor Author

Question: I imported matplotlib at the top of the file just so I could make a link in the references section. Is that the correct way to do things?

@ImportanceOfBeingErnest
Copy link
Member

Well, it's not wrong at least. I think I would prefer to keep it down in the references and instead add the respective flake exception, that is create a similar line to

examples/text_labels_and_annotations/custom_legends.py: E402

for this example.

controls the alignment and rotation of the text. If ``rotation_mode`` is
``None`` or ``default`` the text will first be rotated and then aligned
according to the horizontal and vertical alignments (``ha`` and ``va`` in the
example). If ``rotation_mode`` is ``anchor`` the text is aligned before rotation.

Choose a reason for hiding this comment

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

This line is too long. We have a limit of 80 characters per line enforced by flake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@mollyrossow mollyrossow force-pushed the explain_text_rotation_example branch from 138145a to d5ea808 Compare February 19, 2019 22:06
@mollyrossow
Copy link
Contributor Author

@ImportanceOfBeingErnest I moved the import statement to the references section and added the flake8 exception as you suggested.

@ImportanceOfBeingErnest
Copy link
Member

Thanks very much @mollyrossow for yet another helpul documentation improvement.

tacaswell added a commit that referenced this pull request Feb 20, 2019
…469-on-v3.0.2-doc

Backport PR #13469 on branch v3.0.2-doc (Add explanatory comments for text rotation example)
tacaswell added a commit that referenced this pull request Feb 20, 2019
…469-on-v3.0.x

Backport PR #13469 on branch v3.0.x (Add explanatory comments for text rotation example)
@tacaswell
Copy link
Member

Thanks @mollyrossow !

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.

3 participants