Skip to content
Merged
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
9 changes: 8 additions & 1 deletion xarray/tests/test_plot.py
Original file line number Diff line number Diff line change
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