Skip to content

TST: Add test for visibility of x label and xtick labels for plot.hexbin #60253

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

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

jasonmokk
Copy link
Contributor

@jasonmokk jasonmokk commented Nov 8, 2024

This PR adds a unit test to pandas/tests/plotting/frame/test_frame.py to verify that hexbin plots correctly display x labels and xtick labels. Adds a test for the solved issue described in GH #44050.

@jasonmokk jasonmokk force-pushed the test-hexbin-plot-xlabels branch 4 times, most recently from 747d5da to 691f59e Compare November 8, 2024 19:51
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

lgtm

@rhshadrach rhshadrach added Visualization plotting Needs Tests Unit test(s) needed to prevent regressions labels Nov 8, 2024
@rhshadrach rhshadrach added this to the 3.0 milestone Nov 8, 2024
@@ -2589,6 +2589,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_xticks(self):
# GH#44050
df = DataFrame(np.random.default_rng(2).random((1000, 2)), columns=["a", "b"])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
df = DataFrame(np.random.default_rng(2).random((1000, 2)), columns=["a", "b"])
df = DataFrame(np.random.default_rng(2).random((10, 2)), columns=["a", "b"])

If the test is not dependent on the size of the data, best to keep it minimal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah makes sense, I've updated it.

TST: Add test for visibility of x label and xtick labels for plot.hexbin

TST: Add test for visibility of x label and xtick labels for plot.hexbin

TST: Add test for visibility of x label and xtick labels for plot.hexbin

TST: Add test for visibility of x label and xtick labels for plot.hexbin

Minimize size of test data
@jasonmokk jasonmokk force-pushed the test-hexbin-plot-xlabels branch from 691f59e to a894b64 Compare November 12, 2024 18:39
@mroeschke mroeschke merged commit 2d116df into pandas-dev:main Nov 12, 2024
51 checks passed
@mroeschke
Copy link
Member

Thanks @jasonmokk

@jasonmokk jasonmokk deleted the test-hexbin-plot-xlabels branch November 12, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Tests Unit test(s) needed to prevent regressions Visualization plotting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Hexbin plots does not display x label and xtick labels in pandas 1.3.3
3 participants