Skip to content

Commit

Permalink
Merge pull request #8258 from dstansby/aspect-example
Browse files Browse the repository at this point in the history
DOC: Clean up equal-aspect example
  • Loading branch information
phobson committed Mar 23, 2017
2 parents 6060a40 + f6e2784 commit 16b4ce4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
3 changes: 2 additions & 1 deletion doc/faq/howto_faq.rst
Expand Up @@ -353,7 +353,8 @@ some ratio which controls the ratio::

.. htmlonly::

See :ref:`pylab_examples-equal_aspect_ratio` for a complete example.
See :ref:`subplots_axes_and_figures-plot_equal_aspect_ratio` for a complete
example.


.. _howto-twoscale:
Expand Down
20 changes: 0 additions & 20 deletions examples/pylab_examples/equal_aspect_ratio.py

This file was deleted.

26 changes: 26 additions & 0 deletions examples/subplots_axes_and_figures/plot_equal_aspect_ratio.py
@@ -0,0 +1,26 @@
"""
=================
Equal aspect axes
=================
This example shows how to make a plot whose x and y axes have a 1:1 aspect
ratio.
"""
import matplotlib.pyplot as plt
import numpy as np

t = np.arange(0.0, 1.0 + 0.01, 0.01)
s = np.cos(2 * 2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s, '-', lw=2)

ax.set_xlabel('Time (s)')
ax.set_ylabel('Voltage (mV)')
ax.set_title('About as simple as it gets, folks')
ax.grid(True)

ax.set_aspect('equal', 'datalim')

fig.tight_layout()
plt.show()

0 comments on commit 16b4ce4

Please sign in to comment.