-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Remove hardcoded styling in plot_histogram #8761
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
This should wait for #8762 to be merged so that I can refactor on top of those changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this PR. The feature makes sense to me. Just a small comment on bar_labels
that I dont get.
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Summary
plot_histogram
was hardcoding things like bar colors, font and figure sizes, etc, that were preventing Matplotlib style files from being faithfully applied to the images.Here we remove the hardcoded values, allowing complete customization following the loaded
stylelib
. Users wishing to modify the default settings further can either make their own styles, or take advantage of the fact that one can pass anAxes
object, giving complete control of the customization post-generation.Details and comments
The bar colors are now sourced from the
rcParams
which are in turn set by the style. Most hard-coded options have been removed save for the rotation of the x-axis labels that need to be rotated. I have also disabledbar_labels
by default as for anything more than 2-3Q, the labels are unreadable, and unnecessary given the y-axis is also labeled and the data is included in theCounts
themselves.This allows one to make figures that look like:
or
easily