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

Skip to content

Commit b705e02

Browse files
committed
DOCS: edits to warnings fixes from @timhoffm
1 parent f3bfd10 commit b705e02

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

doc/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def _check_dependencies():
166166
'thumbnail_size': (320, 224),
167167
'compress_images': ('thumbnails', 'images'),
168168
'matplotlib_animations': True,
169-
'abort_on_example_error': True,
170169
}
171170

172171
plot_gallery = 'True'

examples/images_contours_and_fields/contourf_demo.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
66
How to use the `.axes.Axes.contourf` method to create filled contour plots.
77
"""
8-
import copy
9-
108
import numpy as np
119
import matplotlib.pyplot as plt
1210

@@ -89,10 +87,7 @@
8987
# Illustrate all 4 possible "extend" settings:
9088
extends = ["neither", "both", "min", "max"]
9189
cmap = plt.cm.get_cmap("winter")
92-
# we need a copy of the colormap to modify it
93-
cmap = copy.copy(cmap)
94-
cmap.set_under("magenta")
95-
cmap.set_over("yellow")
90+
cmap = cmap.with_extremes(under="magenta", over="yellow")
9691
# Note: contouring simply excludes masked or nan regions, so
9792
# instead of using the "bad" colormap value for them, it draws
9893
# nothing at all in them. Therefore the following would have

examples/subplots_axes_and_figures/secondary_axis.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def rad2deg(x):
5757
ax.set_title('Random spectrum')
5858

5959

60-
def safe_inverse(x):
60+
def one_over(x):
61+
"""Vectorized 1/x, treating x==0 manually"""
6162
x = np.array(x).astype(float)
6263
near_zero = np.isclose(x, 0)
6364
x[near_zero] = np.inf
@@ -66,10 +67,10 @@ def safe_inverse(x):
6667

6768

6869
# the function "1/x" is its own inverse
69-
forward = safe_inverse
70+
inverse = one_over
7071

7172

72-
secax = ax.secondary_xaxis('top', functions=(forward, safe_inverse))
73+
secax = ax.secondary_xaxis('top', functions=(one_over, inverse))
7374
secax.set_xlabel('period [s]')
7475
plt.show()
7576

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,14 @@ def secondary_xaxis(self, location, *, functions=None, **kwargs):
524524
ax.set_xlabel('frequency [Hz]')
525525
526526
def invert(x):
527+
# 1/x with special treatment of x == 0
527528
x = np.array(x).astype(float)
528529
near_zero = np.isclose(x, 0)
529530
x[near_zero] = np.inf
530531
x[~near_zero] = 1 / x[~near_zero]
531532
return x
532533
534+
# the inverse of 1/x is itself
533535
secax = ax.secondary_xaxis('top', functions=(invert, invert))
534536
secax.set_xlabel('Period [s]')
535537
plt.show()

tutorials/intermediate/tight_layout_guide.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def example_plot(ax, fontsize=12):
205205
# complicated layouts, like having one GridSpec in the left and one in the
206206
# right side of the figure. For these use cases, one should instead take
207207
# advantage of :doc:`/gallery/subplots_axes_and_figures/gridspec_nested`, or
208-
# the :doc:`/users/next_whats_new/subfigures`.
208+
# the :doc:`/gallery/subplots_axes_and_figures/subfigures`.
209209

210210

211211
###############################################################################

0 commit comments

Comments
 (0)