From d0a3d6bd8ff58309484e4d86c569feecb344da5f Mon Sep 17 00:00:00 2001 From: Natalia Mokeeva Date: Mon, 29 Jul 2024 11:11:49 +0200 Subject: [PATCH] add a test for visibility of xlabel and xtick labels --- pandas/tests/plotting/frame/test_frame.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandas/tests/plotting/frame/test_frame.py b/pandas/tests/plotting/frame/test_frame.py index b381c4fce8430..e809c26022b96 100644 --- a/pandas/tests/plotting/frame/test_frame.py +++ b/pandas/tests/plotting/frame/test_frame.py @@ -2572,6 +2572,14 @@ def test_plot_period_index_makes_no_right_shift(self, freq): result = ax.get_lines()[0].get_xdata() assert all(str(result[i]) == str(expected[i]) for i in range(4)) + def test_plot_display_xlabel_and_xtick_labels(self): + # GH#44050 + df = DataFrame(np.random.default_rng(2).random((10, 2)), columns=["a", "b"]) + ax = df.plot.hexbin(x="a", y="b") + + _check_visible([ax.xaxis.get_label()], visible=True) + _check_visible(ax.get_xticklabels(), visible=True) + def _generate_4_axes_via_gridspec(): gs = mpl.gridspec.GridSpec(2, 2)