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 ef15140

Browse filesBrowse files
authored
Merge pull request #10570 from anntzer/fixtest
Fix check_shared in test_subplots.
2 parents bae7f77 + 20dcf50 commit ef15140
Copy full SHA for ef15140

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎lib/matplotlib/tests/test_subplots.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_subplots.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from __future__ import absolute_import, division, print_function
2-
1+
import itertools
32
import warnings
43

54
import numpy
@@ -14,14 +13,15 @@ def check_shared(axs, x_shared, y_shared):
1413
x_shared and y_shared are n x n boolean matrices; entry (i, j) indicates
1514
whether the x (or y) axes of subplots i and j should be shared.
1615
"""
17-
shared = [axs[0]._shared_x_axes, axs[0]._shared_y_axes]
18-
for (i1, ax1), (i2, ax2), (i3, (name, shared)) in zip(
16+
for (i1, ax1), (i2, ax2), (i3, (name, shared)) in itertools.product(
1917
enumerate(axs),
2018
enumerate(axs),
2119
enumerate(zip("xy", [x_shared, y_shared]))):
2220
if i2 <= i1:
2321
continue
24-
assert shared[i3].joined(ax1, ax2) == shared[i1, i2], \
22+
assert \
23+
(getattr(axs[0], "_shared_{}_axes".format(name)).joined(ax1, ax2)
24+
== shared[i1, i2]), \
2525
"axes %i and %i incorrectly %ssharing %s axis" % (
2626
i1, i2, "not " if shared[i1, i2] else "", name)
2727

@@ -30,7 +30,7 @@ def check_visible(axs, x_visible, y_visible):
3030
def tostr(v):
3131
return "invisible" if v else "visible"
3232

33-
for (ax, vx, vy) in zip(axs, x_visible, y_visible):
33+
for ax, vx, vy in zip(axs, x_visible, y_visible):
3434
for l in ax.get_xticklabels() + [ax.get_xaxis().offsetText]:
3535
assert l.get_visible() == vx, \
3636
"X axis was incorrectly %s" % (tostr(vx))

0 commit comments

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