8000 Fix and classify equal aspect ratio.py by ericmjl · Pull Request #4628 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix and classify equal aspect ratio.py #4628

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/pylab_examples/contourf_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Demonstrate use of a log color scale in contourf
'''

from matplotlib import pyplot as P
import matplotlib.pyplot as plt
import numpy as np
from numpy import ma
from matplotlib import colors, ticker, cm
Expand Down Expand Up @@ -30,7 +30,7 @@

# Automatic selection of levels works; setting the
# log locator tells contourf to use a log scale:
cs = P.contourf(X, Y, z, locator=ticker.LogLocator(), cmap=cm.PuBu_r)
cs = plt.contourf(X, Y, z, locator=ticker.LogLocator(), cmap=cm.PuBu_r)

# Alternatively, you can manually set the levels
# and the norm:
Expand All @@ -41,6 +41,6 @@

# The 'extend' kwarg does not work yet with a log scale.

cbar = P.colorbar()
cbar = plt.colorbar()

P.show()
plt.show()
21 changes: 11 additions & 10 deletions examples/pylab_examples/equal_aspect_ratio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
Example: simple line plot.
Show how to make a plot that has equal aspect ratio
"""
from pylab import *
import matplotlib.pyplot as plt
import numpy as np

t = arange(0.0, 1.0 + 0.01, 0.01)
s = cos(2*2*pi*t)
plot(t, s, '-', lw=2)
t = np.arange(0.0, 1.0 + 0.01, 0.01)
s = np.cos(2*2*np.pi*t)
plt.plot(t, s, '-', lw=2)

xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)

axes().set_aspect('equal', 'datalim')
plt.axes().set_aspect('equal', 'datalim')


show()
plt.show()
0