Skip to content

Commit ecf5633

Browse files
author
dcherian
committed
Minor fixes.
Don't automatically set histogram ylabel to be 'count'. hist can be used to plot PDFs, in which case that label would be wrong.
1 parent 80f2dd4 commit ecf5633

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

xarray/plot/plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ def hist(darray, figsize=None, size=None, aspect=None, ax=None, **kwargs):
403403

404404
primitive = ax.hist(no_nan, **kwargs)
405405

406-
ax.set_ylabel('Count')
407406
ax.set_title('Histogram')
408407
ax.set_xlabel(label_from_attrs(darray))
409408

@@ -415,7 +414,8 @@ def hist(darray, figsize=None, size=None, aspect=None, ax=None, **kwargs):
415414

416415
def _update_axes(ax, xincrease, yincrease,
417416
xscale=None, yscale=None,
418-
xticks=None, yticks=None, xlim=None, ylim=None):
417+
xticks=None, yticks=None,
418+
xlim=None, ylim=None):
419419
"""
420420
Update axes with provided parameters
421421
"""

xarray/tests/test_plot.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,6 @@ def test_xlabel_uses_name(self):
426426
self.darray.plot.hist()
427427
assert 'testpoints [testunits]' == plt.gca().get_xlabel()
428428

429-
def test_ylabel_is_count(self):
430-
self.darray.plot.hist()
431-
assert 'Count' == plt.gca().get_ylabel()
432-
433429
def test_title_is_histogram(self):
434430
self.darray.plot.hist()
435431
assert 'Histogram' == plt.gca().get_title()
@@ -1682,6 +1678,7 @@ def test_plot_cftime_data_error():
16821678
DataArray(easy_array((10, 3, 2)))]
16831679

16841680

1681+
@requires_matplotlib
16851682
class TestAxesKwargs(object):
16861683
@pytest.mark.parametrize('da', test_da_list)
16871684
@pytest.mark.parametrize('xincrease', [True, False])

0 commit comments

Comments
 (0)