Skip to content

Conversation

yuzie007
Copy link
Contributor

@yuzie007 yuzie007 commented Jan 20, 2023

Always thank you developpers for maintaining Matplotlib!

PR Summary

Currently in hexbin, linewidths given to PolyCollection is hard-coded as 1.0. In pcolormesh and hist2d, the default value respects :rc:patch.linewidth (default: 1.0). To improve the consistency among the methods, in this very short PR I would like to suggest respecting patch.linewidth also in hexbin.

Notes

While this PR does not change the default behavior, do we need to have some additional tests?

The default linewidth in pcolormesh and hist2d may be not immediately visually noticeable because the default edgecolors value is none. (In hexbin, edgecolors defaults to face.)

The default linewidths in pcolor and tripcolor are also hard-coded but as 0.25. It may be also possible to respect :rc:patch.linewidth also in these methods, while the plot looking changes when edgecolors other than none is given.

In principle, it should be also possible to simply remove the linewidths keyword from the arguments and pass it into PolyCollection simply via **kwargs, but then we need to pop linewidths before making marginal plots and need to modify the docstring a bit also for this.

I can also later add note in doc/api/next_api_changes if this is reasonable.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

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

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.

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me. Note that the default mpl.rcParams['patch.lineiwdth'] = 1.0 so this won't be a breaking change for most people. OTOH, if someone has set to non-default this will make a (small) change in appearance. I suspect we could get away with doing this, with an API behaviour change note.

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

Looks good to me - would you be able to put a quick note in doc/api/next_api_changes/behaviour about this just so it's documented for users somewhere?

@oscargus oscargus added this to the v3.8.0 milestone Apr 7, 2023
@oscargus
Copy link
Member

oscargus commented Apr 7, 2023

With a change note this should be good to go in 3.8.

@yuzie007
Copy link
Contributor Author

I am sorry for my long silence... Thank you so much developers for your kind suggestions. I have now added also a note in doc/api/next_api_changes/behaviour.

Although I was not very sure what is the best practice, I did rebase based on the latest main branch and rewrote the changes together with the note above.

@melissawm
Copy link
Member

I believe the failures are unrelated here.

Copy link
Member

@rcomer rcomer left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this @yuzie007 and sorry it’s taken a while to review - I think it just slipped through the cracks. Congratulations on your first PR in Matplotlib! We hope to hear from you again.

@rcomer rcomer merged commit 18b16f3 into matplotlib:main May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

8 participants