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

Skip to content

Commit 3809204

Browse files
committed
DOC: Add more plots to What's new page.
1 parent a1dc966 commit 3809204

1 file changed

Lines changed: 72 additions & 12 deletions

File tree

doc/users/whats_new.rst

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ to further specify the zero location based on the given anchor point.
4242
.. figure:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_002.png
4343
:target: ../gallery/pie_and_polar_charts/polar_scatter.html#scatter-plot-on-polar-axis-with-offset-origin
4444
:align: center
45-
:scale: 50
45+
:scale: 70
4646

4747
Polar Offset Demo
4848

@@ -53,7 +53,7 @@ be used to limit the range of angles plotted, producing sectors of a circle.
5353
.. figure:: /gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_003.png
5454
:target: ../gallery/pie_and_polar_charts/polar_scatter.html#scatter-plot-on-polar-axis-confined-to-a-sector
5555
:align: center
56-
:scale: 50
56+
:scale: 70
5757

5858
Polar Sector Demo
5959

@@ -137,6 +137,27 @@ and whether or not the bar will be filled by default depends on the value of
137137
``True`` or ``False`` to unconditionally always or never use a filled patch
138138
rectangle for the size bar.
139139

140+
Example
141+
~~~~~~~
142+
143+
.. plot::
144+
:include-source:
145+
:align: center
146+
147+
import matplotlib.pyplot as plt
148+
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
149+
150+
fig, ax = plt.subplots(figsize=(3, 3))
151+
152+
bar0 = AnchoredSizeBar(ax.transData, 0.3, 'unfilled', loc=3, frameon=False,
153+
size_vertical=0.05, fill_bar=False)
154+
ax.add_artist(bar0)
155+
bar1 = AnchoredSizeBar(ax.transData, 0.3, 'filled', loc=4, frameon=False,
156+
size_vertical=0.05, fill_bar=True)
157+
ax.add_artist(bar1)
158+
159+
plt.show()
160+
140161

141162
Annotation can use a default arrow style
142163
----------------------------------------
@@ -152,6 +173,31 @@ argument and has a method :meth:`~mpl_toolkits.mplot3d.axes3d.Axes3D.set_proj_ty
152173
The default option is ``'persp'`` as before, and supplying ``'ortho'`` enables
153174
orthographic view.
154175

176+
Example
177+
~~~~~~~
178+
179+
Compare the z-axis which is vertical in orthographic view, but slightly skewed
180+
in the perspective view.
181+
182+
.. plot::
183+
:include-source:
184+
:align: center
185+
186+
import numpy as np
187+
import matplotlib.pyplot as plt
188+
from mpl_toolkits.mplot3d import Axes3D
189+
190+
fig = plt.figure(figsize=(4, 6))
191+
ax1 = fig.add_subplot(2, 1, 1, projection='3d')
192+
ax1.set_proj_type('persp')
193+
ax1.set_title('Perspective (default)')
194+
195+
ax2 = fig.add_subplot(2, 1, 2, projection='3d')
196+
ax2.set_proj_type('ortho')
197+
ax2.set_title('Orthographic')
198+
199+
plt.show()
200+
155201

156202
``voxels`` function for mplot3d
157203
-------------------------------
@@ -160,6 +206,13 @@ orthographic view.
160206
data. Uses could include plotting a sparse 3D heat map, or visualizing a
161207
volumetric model.
162208

209+
.. figure:: /gallery/mplot3d/images/sphx_glr_voxels_numpy_logo_001.png
210+
:target: ../gallery/mplot3d/voxels_numpy_logo.html
211+
:align: center
212+
:scale: 70
213+
214+
Voxel Demo
215+
163216

164217
Barbs and Quiver Support Dates
165218
------------------------------
@@ -275,7 +328,7 @@ A legend entry can now contain more than one legend key. The extended
275328
.. figure:: /gallery/text_labels_and_annotations/images/sphx_glr_legend_demo_004.png
276329
:target: ../gallery/text_labels_and_annotations/legend_demo.html
277330
:align: center
278-
:scale: 50
331+
:scale: 70
279332

280333
Multiple Legend Keys
281334

@@ -410,24 +463,31 @@ to ``False``.
410463

411464
Example
412465
~~~~~~~
413-
::
466+
.. plot::
467+
:include-source:
468+
:align: center
414469

415470
import numpy as np
416471
import matplotlib.pyplot as plt
417472
from mpl_toolkits.mplot3d import Axes3D
418473

419-
fig = plt.figure(figsize=(7,3))
420-
ax1 = fig.add_subplot(121, projection='3d')
421474
x = np.arange(2)
422475
y = np.arange(3)
423476
x2d, y2d = np.meshgrid(x, y)
424-
x2d, y2d = x2d.ravel(), y2d.ravel()
425-
z = x2d + y2d
426-
ax1.bar3d(x2d, y2d, x2d * 0, 1, 1, z, shade=True)
477+
x, y = x2d.ravel(), y2d.ravel()
478+
z = np.zeros_like(x)
479+
dz = x + y
480+
481+
fig = plt.figure(figsize=(4, 6))
482+
ax1 = fig.add_subplot(2, 1, 1, projection='3d')
483+
ax1.bar3d(x, y, z, 1, 1, dz, shade=True)
484+
ax1.set_title('Shading On')
485+
486+
ax2 = fig.add_subplot(2, 1, 2, projection='3d')
487+
ax2.bar3d(x, y, z, 1, 1, dz, shade=False)
488+
ax2.set_title('Shading Off')
427489

428-
ax2 = fig.add_subplot(122, projection='3d')
429-
ax2.bar3d(x2d, y2d, x2d * 0, 1, 1, z, shade=False)
430-
fig.canvas.draw()
490+
plt.show()
431491

432492

433493
New which Parameter for autofmt_xdate

0 commit comments

Comments
 (0)