Skip to content
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

fix the failing matplotlib upstream-dev tests #4201

Merged
merged 1 commit into from Jul 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion xarray/tests/test_plot.py
Expand Up @@ -88,6 +88,13 @@ def easy_array(shape, start=0, stop=1):
return a.reshape(shape)


def get_colorbar_label(colorbar):
if colorbar.orientation == "vertical":
return colorbar.ax.get_ylabel()
else:
return colorbar.ax.get_xlabel()
Comment on lines +91 to +95
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might make sense to push this upstream as colorbar.get_label()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!



@requires_matplotlib
class PlotTestCase:
@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -1414,7 +1421,7 @@ def test_facetgrid_cbar_kwargs(self):

# catch contour case
if hasattr(g, "cbar"):
assert g.cbar._label == "test_label"
assert get_colorbar_label(g.cbar) == "test_label"

def test_facetgrid_no_cbar_ax(self):
a = easy_array((10, 15, 2, 3))
Expand Down