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

[SPARK-49716][PS][DOCS][TESTS] Fix documentation and add test of barh plot #48161

Closed
wants to merge 3 commits into from

Conversation

xinrong-meng
Copy link
Member

@xinrong-meng xinrong-meng commented Sep 19, 2024

What changes were proposed in this pull request?

  • Update the documentation for barh plot to clarify the difference between axis interpretation in Plotly and Matplotlib.
  • Test multiple columns as value axis.

The parameter difference is demonstrated as below.

>>> df = ps.DataFrame({'lab': ['A', 'B', 'C'], 'val': [10, 30, 20]})
>>> df.plot.barh(x='val', y='lab').show()  # plot1

>>> ps.set_option('plotting.backend', 'matplotlib')
>>> import matplotlib.pyplot as plt
>>> df.plot.barh(x='lab', y='val')
>>> plt.show()  # plot2

plot1
newplot (5)

plot2
Figure_1

Why are the changes needed?

The barh plot’s x and y axis behavior differs between Plotly and Matplotlib, which may confuse users. The updated documentation and tests help ensure clarity and prevent misinterpretation.

Does this PR introduce any user-facing change?

No. Doc change only.

How was this patch tested?

Unit tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@xinrong-meng xinrong-meng changed the title [SPARK-49716][PS] Imrpove documentation and test of barh plot [SPARK-49716][PS] Fix documentation and test of barh plot Sep 19, 2024
@xinrong-meng xinrong-meng changed the title [SPARK-49716][PS] Fix documentation and test of barh plot [SPARK-49716][PS] Fix documentation and add test of barh plot Sep 19, 2024
@xinrong-meng xinrong-meng changed the title [SPARK-49716][PS] Fix documentation and add test of barh plot [SPARK-49716][PS][DOCS] Fix documentation and add test of barh plot Sep 19, 2024
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-49716][PS][DOCS] Fix documentation and add test of barh plot [SPARK-49716][PS][DOCS][TESTS] Fix documentation and add test of barh plot Sep 19, 2024
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you, @xinrong-meng .
Merged to master.

@xinrong-meng
Copy link
Member Author

Thank you @dongjoon-hyun !

attilapiros pushed a commit to attilapiros/spark that referenced this pull request Oct 4, 2024
… plot

### What changes were proposed in this pull request?
- Update the documentation for barh plot to clarify the difference between axis interpretation in Plotly and Matplotlib.
- Test multiple columns as value axis.

The parameter difference is demonstrated as below.
```py
>>> df = ps.DataFrame({'lab': ['A', 'B', 'C'], 'val': [10, 30, 20]})
>>> df.plot.barh(x='val', y='lab').show()  # plot1

>>> ps.set_option('plotting.backend', 'matplotlib')
>>> import matplotlib.pyplot as plt
>>> df.plot.barh(x='lab', y='val')
>>> plt.show()  # plot2
```

plot1
![newplot (5)](https://github.com/user-attachments/assets/f1b6fabe-9509-41bb-8cfb-0733f65f1643)

plot2
![Figure_1](https://github.com/user-attachments/assets/10e1b65f-6116-4490-9956-29e1fbf0c053)

### Why are the changes needed?
The barh plot’s x and y axis behavior differs between Plotly and Matplotlib, which may confuse users. The updated documentation and tests help ensure clarity and prevent misinterpretation.

### Does this PR introduce _any_ user-facing change?
No. Doc change only.

### How was this patch tested?
Unit tests.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#48161 from xinrong-meng/ps_barh.

Authored-by: Xinrong Meng <xinrong@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants