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

Skip to content

TST: Add a test of bar3d from two more angles #12273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
import numpy as np


@pytest.fixture
def baseline_images(request, extension):
# strip the leading test_, and the file extension from the parameters
name = request.node.name
if name.startswith('test_'):
name = name[5:]
name = name.replace('[{}-'.format(extension), '[')
name = name.replace('[]', '')
return [name]


@image_comparison(baseline_images=['bar3d'], remove_text=True)
def test_bar3d():
fig = plt.figure()
Expand All @@ -21,12 +32,13 @@ def test_bar3d():
ax.bar(xs, ys, zs=z, zdir='y', align='edge', color=cs, alpha=0.8)


@pytest.mark.parametrize('azim, elev', [(-60, 30), (-120, 30), (120, -30)])
@image_comparison(
baseline_images=['bar3d_shaded'],
baseline_images=None,
remove_text=True,
extensions=['png']
)
def test_bar3d_shaded():
def test_bar3d_shaded(baseline_images, azim, elev):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = np.arange(4)
Expand All @@ -35,6 +47,7 @@ def test_bar3d_shaded():
x2d, y2d = x2d.ravel(), y2d.ravel()
z = x2d + y2d
ax.bar3d(x2d, y2d, x2d * 0, 1, 1, z, shade=True)
ax.view_init(azim=azim, elev=elev)
fig.canvas.draw()


Expand Down