Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5833512

Browse filesBrowse files
Update tests
1 parent 88d616f commit 5833512
Copy full SHA for 5833512

File tree

Expand file treeCollapse file tree

2 files changed

+15
-13
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-13
lines changed

‎lib/mpl_toolkits/mplot3d/proj3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/proj3d.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ def rotation_about_vector(v, angle):
7373

7474

7575
def view_axes(E, R, V, roll):
76-
'''
76+
"""
7777
u, v, and n are the view axes
7878
u is towards the right
7979
v is towards the top
8080
n is the vector out of the screen
81-
'''
81+
"""
8282
n = (E - R)
8383
n = n/np.linalg.norm(n)
8484
u = np.cross(V, n)

‎lib/mpl_toolkits/tests/test_mplot3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_mplot3d.py
+13-11Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,8 @@ def _test_proj_make_M():
876876
R = np.array([100, 100, 100])
877877
V = np.array([0, 0, 1])
878878
roll = 0
879-
viewM = proj3d.view_transformation(E, R, V, roll)
879+
u, v, n = proj3d.view_axes(E, R, V, roll)
880+
viewM = proj3d.view_transformation(u, v, n, E)
880881
perspM = proj3d.persp_transformation(100, -100, 1)
881882
M = np.dot(perspM, viewM)
882883
return M
@@ -942,7 +943,8 @@ def test_proj_axes_cube_ortho():
942943
R = np.array([0, 0, 0])
943944
V = np.array([0, 0, 1])
944945
roll = 0
945-
viewM = proj3d.view_transformation(E, R, V, roll)
946+
u, v, n = proj3d.view_axes(E, R, V, roll)
947+
viewM = proj3d.view_transformation(u, v, n, E)
946948
orthoM = proj3d.ortho_transformation(-1, 1)
947949
M = np.dot(orthoM, viewM)
948950

@@ -1533,16 +1535,16 @@ def convert_lim(dmin, dmax):
15331535

15341536
@pytest.mark.parametrize("tool,button,expected",
15351537
[("zoom", MouseButton.LEFT, # zoom in
1536-
((-0.02, 0.06), (0, 0.06), (-0.01, 0.06))),
1538+
((0.03, 0.61), (0.27, 0.71), (0.32, 0.89))),
15371539
("zoom", MouseButton.RIGHT, # zoom out
1538-
((-0.13, 0.06), (-0.18, 0.06), (-0.17, 0.06))),
1540+
((0.29, 0.35), (0.44, 0.53), (0.57, 0.64))),
15391541
("pan", MouseButton.LEFT,
1540-
((-0.46, -0.34), (-0.66, -0.54), (-0.62, -0.5)))])
1542+
((-0.70, -0.58), (-1.03, -0.91), (-1.27, -1.15)))])
15411543
def test_toolbar_zoom_pan(tool, button, expected):
1542-
# NOTE: The expected values are rough ballparks of moving in the view
1544+
# NOTE: The expected zoom values are rough ballparks of moving in the view
15431545
# to make sure we are getting the right direction of motion.
1544-
# The specific values can and should change if the zoom/pan
1545-
# movement scaling factors get updated.
1546+
# The specific values can and should change if the zoom movement
1547+
# scaling factor gets updated.
15461548
fig = plt.figure()
15471549
ax = fig.add_subplot(projection='3d')
15481550
ax.scatter(0, 0, 0)
@@ -1577,9 +1579,9 @@ def test_toolbar_zoom_pan(tool, button, expected):
15771579

15781580
# Should be close, but won't be exact due to screen integer resolution
15791581
xlim, ylim, zlim = expected
1580-
assert (ax.get_xlim3d()) == pytest.approx(xlim, abs=0.01)
1581-
assert (ax.get_ylim3d()) == pytest.approx(ylim, abs=0.01)
1582-
assert (ax.get_zlim3d()) == pytest.approx(zlim, abs=0.01)
1582+
assert ax.get_xlim3d() == pytest.approx(xlim, abs=0.01)
1583+
assert ax.get_ylim3d() == pytest.approx(ylim, abs=0.01)
1584+
assert ax.get_zlim3d() == pytest.approx(zlim, abs=0.01)
15831585

15841586

15851587
@mpl.style.context('default')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.