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

Skip to content

Commit c0cd944

Browse files
authored
Merge pull request #8858 from dstansby/pylab-moves3
Pylab example moves 3
2 parents 87638e3 + d4021aa commit c0cd944

26 files changed

Lines changed: 72 additions & 83 deletions

doc/users/prev_whats_new/whats_new_1.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ Additionally, he has contributed a new module :mod:`~matplotlib.tri` and
5858
helper function :func:`~matplotlib.pyplot.triplot` for creating and
5959
plotting unstructured triangular grids.
6060

61-
.. figure:: ../../gallery/pylab_examples/images/sphx_glr_triplot_demo_001.png
62-
:target: ../../gallery/pylab_examples/triplot_demo.html
61+
.. figure:: ../../gallery/images_contours_and_fields/images/sphx_glr_triplot_demo_001.png
62+
:target: ../../gallery/images_contours_and_fields/triplot_demo.html
6363
:align: center
6464
:scale: 50
6565

doc/users/prev_whats_new/whats_new_1.2.rst

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ Ian Thomas extended :meth:`~matplotlib.pyplot.tripcolor` to allow one color
200200
value to be specified for each triangular face rather than for each point in
201201
a triangulation.
202202

203-
.. figure:: ../../gallery/pylab_examples/images/sphx_glr_tripcolor_demo_001.png
204-
:target: ../../gallery/pylab_examples/tripcolor_demo.html
203+
.. figure:: ../../gallery/images_contours_and_fields/images/sphx_glr_tripcolor_demo_001.png
204+
:target: ../../gallery/images_contours_and_fields/tripcolor_demo.html
205205
:align: center
206206
:scale: 50
207207

@@ -214,8 +214,8 @@ Phil Elson added support for hatching to
214214
:func:`~matplotlib.pyplot.contourf`, together with the ability
215215
to use a legend to identify contoured ranges.
216216

217-
.. figure:: ../../gallery/pylab_examples/images/sphx_glr_contourf_hatching_001.png
218-
:target: ../../gallery/pylab_examples/contourf_hatching.html
217+
.. figure:: ../../gallery/images_contours_and_fields/images/sphx_glr_contourf_hatching_001.png
218+
:target: ../../gallery/images_contours_and_fields/contourf_hatching.html
219219
:align: center
220220
:scale: 50
221221

@@ -227,8 +227,3 @@ Known issues in the matplotlib 1.2 release
227227
- When using the Qt4Agg backend with IPython 0.11 or later, the save
228228
dialog will not display. This should be fixed in a future version
229229
of IPython.
230-
231-
232-
233-
234-

doc/users/prev_whats_new/whats_new_1.3.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ perform mesh refinement and smooth contouring was also added
141141
implementing some basic tools for triangular mesh improvement was
142142
added (:class:`~matplotlib.tri.TriAnalyzer`).
143143

144-
.. figure:: ../../gallery/pylab_examples/images/sphx_glr_tricontour_smooth_user_001.png
145-
:target: ../../gallery/pylab_examples/tricontour_smooth_user.html
144+
.. figure:: ../../gallery/images_contours_and_fields/images/sphx_glr_tricontour_smooth_user_001.png
145+
:target: ../../gallery/images_contours_and_fields/tricontour_smooth_user.html
146146
:align: center
147147
:scale: 50
148148

@@ -400,9 +400,3 @@ matplotlib will now display a `RuntimeWarning` when too many figures
400400
have been opened at once. By default, this is displayed for 20 or
401401
more figures, but the exact number may be controlled using the
402402
``figure.max_open_warning`` rcParam.
403-
404-
405-
406-
407-
408-
File renamed without changes.

examples/pylab_examples/contour_image.py renamed to examples/images_contours_and_fields/contour_image.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
2929
Z = (Z1 - Z2) * 10
3030

31-
levels = np.arange(-2.0, 1.601, 0.4) # Boost the upper limit to avoid truncation errors.
31+
# Boost the upper limit to avoid truncation errors.
32+
levels = np.arange(-2.0, 1.601, 0.4)
3233

3334
norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max())
3435
cmap = cm.PRGn
@@ -40,9 +41,7 @@
4041
plt.subplot(2, 2, 1)
4142

4243
cset1 = plt.contourf(X, Y, Z, levels,
43-
cmap=cm.get_cmap(cmap, len(levels) - 1),
44-
norm=norm,
45-
)
44+
cmap=cm.get_cmap(cmap, len(levels) - 1), norm=norm)
4645
# It is not necessary, but for the colormap, we need only the
4746
# number of levels minus 1. To avoid discretization error, use
4847
# either this number or a large number such as the default (256).
@@ -94,7 +93,8 @@
9493
# This is intentional. The Z values are defined at the center of each
9594
# image pixel (each color block on the following subplot), so the
9695
# domain that is contoured does not extend beyond these pixel centers.
97-
im = plt.imshow(Z, interpolation='nearest', extent=extent, cmap=cmap, norm=norm)
96+
im = plt.imshow(Z, interpolation='nearest', extent=extent,
97+
cmap=cmap, norm=norm)
9898
v = plt.axis()
9999
plt.contour(Z, levels, colors='k', origin='image', extent=extent)
100100
plt.axis(v)

examples/pylab_examples/contour_label_demo.py renamed to examples/images_contours_and_fields/contour_label_demo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def __repr__(self):
4848
else:
4949
return '%.1f' % self.__float__()
5050

51+
5152
# Recast levels to new class
5253
CS.levels = [nf(val) for val in CS.levels]
5354

examples/pylab_examples/contourf_demo.py renamed to examples/images_contours_and_fields/contourf_demo.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import matplotlib.pyplot as plt
99

1010
origin = 'lower'
11-
#origin = 'upper'
1211

1312
delta = 0.025
1413

@@ -21,13 +20,13 @@
2120
nr, nc = Z.shape
2221

2322
# put NaNs in one corner:
24-
Z[-nr//6:, -nc//6:] = np.nan
23+
Z[-nr // 6:, -nc // 6:] = np.nan
2524
# contourf will convert these to masked
2625

2726

2827
Z = np.ma.array(Z)
2928
# mask another corner:
30-
Z[:nr//6, :nc//6] = np.ma.masked
29+
Z[:nr // 6, :nc // 6] = np.ma.masked
3130

3231
# mask a circle in the middle:
3332
interior = np.sqrt((X**2) + (Y**2)) < 0.5
@@ -37,20 +36,14 @@
3736
# this is usually not such a good idea, because they don't
3837
# occur on nice boundaries, but we do it here for purposes
3938
# of illustration.
40-
CS = plt.contourf(X, Y, Z, 10,
41-
#[-1, -0.1, 0, 0.1],
42-
#alpha=0.5,
43-
cmap=plt.cm.bone,
44-
origin=origin)
39+
CS = plt.contourf(X, Y, Z, 10, cmap=plt.cm.bone, origin=origin)
4540

4641
# Note that in the following, we explicitly pass in a subset of
4742
# the contour levels used for the filled contours. Alternatively,
4843
# We could pass in additional levels to provide extra resolution,
4944
# or leave out the levels kwarg to use all of the original levels.
5045

51-
CS2 = plt.contour(CS, levels=CS.levels[::2],
52-
colors='r',
53-
origin=origin)
46+
CS2 = plt.contour(CS, levels=CS.levels[::2], colors='r', origin=origin)
5447

5548
plt.title('Nonsense (3 masked regions)')
5649
plt.xlabel('word length anomaly')
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)