FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow constructing boxplots over multiple calls. by anntzer · Pull Request #13444 · matplotlib/matplotlib · GitHub

Repository navigation

Allow constructing boxplots over multiple calls. - #13444

Merged
phobson merged 1 commit into
matplotlib:masterfrom
anntzer:boxplot-multiple
Feb 18, 2019
Merged

phobson merged 1 commit into
matplotlib:masterfrom
anntzer:boxplot-multiple

Conversation

anntzer commented Feb 15, 2019

Copy link
Copy Markdown
Contributor

Currently, calls to boxplot() set the axis limits, ticks, and ticklabels
assuming that nothing else, and in particular no other boxplot, will be
drawn on the axis; e.g., after

boxplot(np.random.rand(100), positions=[3])
boxplot(np.random.rand(100), positions=[5])

the xlims will be moved to hide the first boxplot, and even after
manually resetting the xlims, the tick at x=3 and its label will be gone
too.

Fix that to make boxplot a bit more cooperative with previous calls:
instead of forcefully setting the axis limits, just update the dataLim
and let autoscaling handle axis limits; also check whether the axis
already has a FixedLocator/FixedFormatter and if so, just append the new
tick locations and labels.

Also rename manage_xticks to manage_ticks (with deprecation), as the
direction it manages depends on the vert kwarg (discussed in #13435).

attn @phobson I guess.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Currently, calls to boxplot() set the axis limits, ticks, and ticklabels
assuming that nothing else, and in particular no other boxplot, will be
drawn on the axis; e.g., after

    boxplot(np.random.rand(100), positions=[3])
    boxplot(np.random.rand(100), positions=[5])

the xlims will be moved to hide the first boxplot, and even after
manually resetting the xlims, the tick at x=3 and its label will be gone
too.

Fix that to make boxplot a bit more cooperative with previous calls:
instead of forcefully setting the axis limits, just update the dataLim
and let autoscaling handle axis limits; also check whether the axis
already has a FixedLocator/FixedFormatter and if so, just append the new
tick locations and labels.

Also rename manage_xticks to manage_ticks (with deprecation), as the
direction it manages depends on the vert kwarg.

phobson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks @anntzer !

phobson merged commit b87182d into matplotlib:master Feb 18, 2019
anntzer deleted the boxplot-multiple branch February 18, 2019 15:11
QuLogic added this to the v3.1.0 milestone Feb 18, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL