(fig_test, fig_ref)
| 1392 | |
| 1393 | @check_figures_equal() |
| 1394 | def test_axlim_clip(fig_test, fig_ref): |
| 1395 | # With axlim clipping |
| 1396 | ax = fig_test.add_subplot(projection="3d") |
| 1397 | x = np.linspace(0, 1, 11) |
| 1398 | y = np.linspace(0, 1, 11) |
| 1399 | X, Y = np.meshgrid(x, y) |
| 1400 | Z = X + Y |
| 1401 | ax.plot_surface(X, Y, Z, facecolor='C1', edgecolors=None, |
| 1402 | rcount=50, ccount=50, axlim_clip=True) |
| 1403 | # This ax.plot is to cover the extra surface edge which is not clipped out |
| 1404 | ax.plot([0.5, 0.5], [0, 1], [0.5, 1.5], |
| 1405 | color='k', linewidth=3, zorder=5, axlim_clip=True) |
| 1406 | ax.scatter(X.ravel(), Y.ravel(), Z.ravel() + 1, axlim_clip=True) |
| 1407 | ax.quiver(X.ravel(), Y.ravel(), Z.ravel() + 2, |
| 1408 | 0*X.ravel(), 0*Y.ravel(), 0*Z.ravel() + 1, |
| 1409 | arrow_length_ratio=0, axlim_clip=True) |
| 1410 | ax.plot(X[0], Y[0], Z[0] + 3, color='C2', axlim_clip=True) |
| 1411 | ax.text(1.1, 0.5, 4, 'test', axlim_clip=True) # won't be visible |
| 1412 | ax.set(xlim=(0, 0.5), ylim=(0, 1), zlim=(0, 5)) |
| 1413 | |
| 1414 | # With manual clipping |
| 1415 | ax = fig_ref.add_subplot(projection="3d") |
| 1416 | idx = (X <= 0.5) |
| 1417 | X = X[idx].reshape(11, 6) |
| 1418 | Y = Y[idx].reshape(11, 6) |
| 1419 | Z = Z[idx].reshape(11, 6) |
| 1420 | ax.plot_surface(X, Y, Z, facecolor='C1', edgecolors=None, |
| 1421 | rcount=50, ccount=50, axlim_clip=False) |
| 1422 | ax.plot([0.5, 0.5], [0, 1], [0.5, 1.5], |
| 1423 | color='k', linewidth=3, zorder=5, axlim_clip=False) |
| 1424 | ax.scatter(X.ravel(), Y.ravel(), Z.ravel() + 1, axlim_clip=False) |
| 1425 | ax.quiver(X.ravel(), Y.ravel(), Z.ravel() + 2, |
| 1426 | 0*X.ravel(), 0*Y.ravel(), 0*Z.ravel() + 1, |
| 1427 | arrow_length_ratio=0, axlim_clip=False) |
| 1428 | ax.plot(X[0], Y[0], Z[0] + 3, color='C2', axlim_clip=False) |
| 1429 | ax.set(xlim=(0, 0.5), ylim=(0, 1), zlim=(0, 5)) |
| 1430 | |
| 1431 | |
| 1432 | @pytest.mark.parametrize('value', [np.inf, np.nan]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…