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

Skip to content

Commit 724cd88

Browse files
dkweiss31timhoffm
andauthored
Update galleries/examples/subplots_axes_and_figures/secondary_axis.py
simplify interpolation Co-authored-by: Tim Hoffmann <[email protected]>
1 parent 132c838 commit 724cd88

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

galleries/examples/subplots_axes_and_figures/secondary_axis.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,9 @@ def one_over(x):
120120
ax.set_xlabel(r'$x_1$')
121121
ax.legend()
122122

123-
# need to define mapped values outside of plotted range to ensure the secondary
124-
# axis is plotted correctly
125-
x1n = np.concatenate(([-1e10, 0], x1_vals, [20, 1e10]))
126-
x2n = np.concatenate(([-1e10, 0], x2_vals, [20**2, 1e10**2]))
123+
# the forward and inverse functions must be defined on the complete visible axis range
124+
x1n = np.linspace(0, 20, 201)
125+
x2n = x1n**2
127126

128127

129128
def forward(x):

0 commit comments

Comments
 (0)