Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1b17ec

Browse files
committed
add imports where needed
1 parent 04409c8 commit e1b17ec

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

examples/pylab_examples/colorbar_tick_labelling_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import matplotlib.pyplot as plt
77
import numpy as np
8-
8+
from matplotlib import cm
99
from numpy.random import randn
1010

1111
# Make plot with vertical (default) colorbar

examples/pylab_examples/contourf_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from matplotlib import pyplot as P
66
import numpy as np
77
from numpy import ma
8-
from matplotlib import colors, ticker
8+
from matplotlib import colors, ticker, cm
99
from matplotlib.mlab import bivariate_normal
1010

1111
N = 100

examples/pylab_examples/customize_rc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
"""
3-
I'm not trying to make a good liking figure here, but just to show
3+
I'm not trying to make a good looking figure here, but just to show
44
some examples of customizing rc params on the fly
55
66
If you like to work interactively, and need to create different sets

examples/pylab_examples/hexbin_demo.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"""
77

88
import numpy as np
9-
import matplotlib.cm as cm
10-
import matplotlib.pyplot as plt
9+
import matplotlib.pyplot as plt
1110

1211
np.random.seed(0)
1312
n = 100000
@@ -20,14 +19,14 @@
2019

2120
plt.subplots_adjust(hspace=0.5)
2221
plt.subplot(121)
23-
plt.hexbin(x,y, cmap=cm.YlOrRd_r)
22+
plt.hexbin(x,y, cmap=plt.cm.YlOrRd_r)
2423
plt.axis([xmin, xmax, ymin, ymax])
2524
plt.title("Hexagon binning")
2625
cb = plt.colorbar()
2726
cb.set_label('counts')
2827

2928
plt.subplot(122)
30-
plt.hexbin(x,y,bins='log', cmap=cm.YlOrRd_r)
29+
plt.hexbin(x,y,bins='log', cmap=plt.cm.YlOrRd_r)
3130
plt.axis([xmin, xmax, ymin, ymax])
3231
plt.title("With a log color scale")
3332
cb = plt.colorbar()

examples/pylab_examples/hexbin_demo2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
gridsize=30
4040

4141
plt.subplot(211)
42-
plt.hexbin(x,y, C=z, gridsize=gridsize, marginals=True, cmap=cm.RdBu, vmax=abs(z).max(), vmin=-abs(z).max()) # NEEDS NORM
42+
plt.hexbin(x,y, C=z, gridsize=gridsize, marginals=True, cmap=plt.cm.RdBu, vmax=abs(z).max(), vmin=-abs(z).max()) # NEEDS NORM
4343
plt.axis([xmin, xmax, ymin, ymax])
4444
cb = plt.colorbar()
4545
cb.set_label('mean value')
4646

4747

4848
plt.subplot(212)
49-
plt.hexbin(x,y, gridsize=gridsize, cmap=cm.Blues_r)
49+
plt.hexbin(x,y, gridsize=gridsize, cmap=plt.cm.Blues_r)
5050
plt.axis([xmin, xmax, ymin, ymax])
5151
cb = plt.colorbar()
5252
cb.set_label('N observations')

examples/pylab_examples/image_nonuniform.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from matplotlib.pyplot import figure, show
88
import numpy as np
99
from matplotlib.image import NonUniformImage
10+
from matplotlib import cm
1011

1112
interp='nearest'
1213

examples/pylab_examples/tricontour_vs_griddata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
yi = np.linspace(-2.1,2.1,ngridy)
2525
zi = griddata(x,y,z,xi,yi,interp='linear')
2626
plt.contour(xi,yi,zi,15,linewidths=0.5,colors='k')
27-
plt.contourf(xi,yi,zi,15,cmap=plt.cm.rainbow, norm = Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max()))
27+
plt.contourf(xi,yi,zi,15,cmap=plt.cm.rainbow, norm=plt.normalize(vmax=abs(zi).max(), vmin=-abs(zi).max()))
2828
plt.colorbar() # draw colorbar
2929
plt.plot(x, y, 'ko', ms=3)
3030
plt.xlim(-2,2)
@@ -37,7 +37,7 @@
3737
plt.subplot(212)
3838
triang = tri.Triangulation(x, y)
3939
plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k')
40-
plt.tricontourf(x, y, z, 15, cmap=plt.cm.rainbow, norm = Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max()))
40+
plt.tricontourf(x, y, z, 15, cmap=plt.cm.rainbow, norm=plt.normalize(vmax=abs(zi).max(), vmin=-abs(zi).max()))
4141
plt.colorbar()
4242
plt.plot(x, y, 'ko', ms=3)
4343
plt.xlim(-2,2)

examples/pylab_examples/tripcolor_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
# pcolor plot.
3636
plt.figure()
3737
plt.gca().set_aspect('equal')
38-
plt.tripcolor(triang, z, shading='flat', cmap = cm.rainbow)
38+
plt.tripcolor(triang, z, shading='flat', cmap = plt.cm.rainbow)
3939
plt.colorbar()
4040
plt.title('tripcolor of Delaunay triangulation: flat')
4141

4242
# Illustrate Gouraud shading.
4343
plt.figure()
4444
plt.gca().set_aspect('equal')
45-
plt.tripcolor(triang, z, shading='gouraud', cmap = cm.rainbow)
45+
plt.tripcolor(triang, z, shading='gouraud', cmap = plt.cm.rainbow)
4646
plt.colorbar()
4747
plt.title('tripcolor with Gouraud shading')
4848

0 commit comments

Comments
 (0)