diff --git a/examples/pylab_examples/contourf_log.py b/examples/pylab_examples/contourf_log.py index ceea635c3e95..c64b0b708eb3 100644 --- a/examples/pylab_examples/contourf_log.py +++ b/examples/pylab_examples/contourf_log.py @@ -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 @@ -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: @@ -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() diff --git a/examples/pylab_examples/equal_aspect_ratio.py b/examples/pylab_examples/equal_aspect_ratio.py index e2c5dd3056e9..b40aebe2f126 100755 --- a/examples/pylab_examples/equal_aspect_ratio.py +++ b/examples/pylab_examples/equal_aspect_ratio.py @@ -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()