Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Revise scatter_masked.py #24409

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Revise scatter_masked.py #24409

wants to merge 1 commit into from

Conversation

hoffm386
Copy link

@hoffm386 hoffm386 commented Nov 9, 2022

  • Expand introduction, including link to NumPy documentation
  • Simplify plot styling to avoid distraction and overlap
  • Add an example using a decision boundary style
  • Add references admonition at the end

PR Summary

Resolves #24357

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [N/A] New plotting related features are documented with examples.

Release Notes

  • [N/A] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • [N/A] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • [N/A] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

- Expand introduction, including link to NumPy documentation
- Simplify plot styling to avoid distraction and overlap
- Add an example using a decision boundary style
- Add references admonition at the end
@oscargus oscargus added this to the v3.6-doc milestone Nov 9, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@story645 story645 self-assigned this Nov 10, 2022
Comment on lines +31 to +35
subplot_kw = {
'aspect': 'equal',
'xlim': (0, max(x)),
'ylim': (0, max(y))
}
Copy link
Member

Choose a reason for hiding this comment

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

I didn't know we could do this 😄 and I would maybe not put the comment here 'cause I think it makes it seem like this line has something to do w/ the masking specifically

Copy link
Author

Choose a reason for hiding this comment

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

It's a nice clean approach if you want to create two different plots with the same axes properties, rather than calling methods to set them 🙂

Fair point, what if I moved the comment like this:

subplot_kw = {
    'aspect': 'equal',
    'xlim': (0, max(x)),
    'ylim': (0, max(y))
}
fig, ax = plt.subplots(subplot_kw=subplot_kw)

# Plot data points using masked array
ax.scatter(x, y, s=masked_size, marker='^', c="mediumseagreen")

@hoffm386
Copy link
Author

Built doc page for scatter_masked.py is here

Comment on lines +46 to +52

###############################################################################
# This technique can also be used to plot a decision boundary, rather than
# masking certain data points so that they don't appear at all. This example
# uses the same data points and boundary as the example above, this time in the
# style of a decision boundary.

Copy link
Member

Choose a reason for hiding this comment

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

I would tend to just be specific about what you are doing, but use general language. If you want the technical term yo think people will search on, by all means include it. Maybe something like:

Suggested change
###############################################################################
# This technique can also be used to plot a decision boundary, rather than
# masking certain data points so that they don't appear at all. This example
# uses the same data points and boundary as the example above, this time in the
# style of a decision boundary.
###############################################################################
# This technique can be used to plot two groups of data separated by a boundary (sometimes
# termed a "decision boundary"). This example uses two sets of masks to color the data on either
# side of the boundary differently, and adds a shape to define the boundary.

Copy link
Author

Choose a reason for hiding this comment

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

Ok gotcha, you're saying to use more general language to describe what the plotting code is doing. Not to explain the ML concept in more general language. That makes sense!

@melissawm
Copy link
Member

Hi @hoffm386 - let us know if we can help you with this PR, thanks!

@QuLogic QuLogic modified the milestones: v3.6-doc, v3.7.0 Jan 11, 2023
@tacaswell tacaswell modified the milestones: v3.7.0, v3.8.0 Feb 9, 2023
@ksunden ksunden modified the milestones: v3.8.0, v3.8-doc Aug 8, 2023
@story645
Copy link
Member

@hoffm386 just checking in if you have the bandwidth to finish this up (it looks pretty close to done for me) or if you're cool with it being taken over and finished out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

[Doc]: Revise "Scatter Masked" Example
8 participants