Skip to content

Simplify some examples. #8741

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
Jun 13, 2017
Merged

Simplify some examples. #8741

merged 1 commit into from
Jun 13, 2017

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 10, 2017

vline_hline_demo: Simpler data generation; use subplots; no need to
explicitly construct a blended transform.

equal_aspect_ratio: Removed; forcing equal aspect ratio when the x and
y axes have different units is pretty silly anyways, plus it does not
belong in subplots_axes_and_figures. Instead, tweaked the last
example of axis_equal_demo to demonstrate some more related features.

PR Summary

PR Checklist

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

plt.axis([-3, 3, -3, 3])
plt.plot([0, 4], [0, 4])
plt.title('still equal after adding line', fontsize=10)
plt.gca().set_aspect('equal', 'box')
Copy link
Member

Choose a reason for hiding this comment

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

Could also do with a plt.subplots() and removing all the plt.subplot calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


vax.plot(t, s + nse, '^')
vax.vlines(t, [0], s)
vax.vlines([1, 2], 0, 1, transform=btf(vax.transData, vax.transAxes), colors='r')
vax.vlines([1, 2], 0, 1, transform=vax.get_xaxis_transform(), colors='r')
Copy link
Member

Choose a reason for hiding this comment

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

I feel like vax.get_xaxis_transform() would benefit from an explanatory comment of why it's in this code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you get to write it then :)

Copy link
Member

Choose a reason for hiding this comment

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

I have no idea why it's there, hence why I'd like to see that comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

"""


import matplotlib.pyplot as plt
import numpy as np

# Plot circle or radius 3
Copy link
Member

Choose a reason for hiding this comment

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

type: circle of radius 3

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

`vline_hline_demo`: Simpler data generation; use `subplots`; no need to
explicitly construct a blended transform.

`equal_aspect_ratio`: Removed; forcing equal aspect ratio when the x and
y axes have different units is pretty silly anyways, plus it does not
belong in `subplots_axes_and_figures`.  Instead, tweaked the last
example of `axis_equal_demo` to demonstrate some more related features.
Copy link
Member

@story645 story645 left a comment

Choose a reason for hiding this comment

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

Thanks!

@dstansby dstansby added this to the 2.1 (next point release) milestone Jun 13, 2017
@dstansby dstansby merged commit 7139b51 into matplotlib:master Jun 13, 2017
@anntzer anntzer deleted the docs-cleanups branch June 13, 2017 14:32
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