8000 Simplify ribbon_box example. by anntzer · Pull Request #14117 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Simplify ribbon_box example. #14117

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

Merged
merged 1 commit into from
May 4, 2019
Merged

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented May 2, 2019
  • Use AxesImage instead of the more obscure BboxImage.
  • Just hardcode the data instead of random-generating it and rounding it
    to hundreds when displaying.
  • Misc cleanups.

Inspired by #14057 (thanks @timhoffm)

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


fmt = ScalarFormatter(useOffset=False)
ax.xaxis.set_major_formatter(fmt)
heights = [7900, 8100, 7900, 6900, 9800]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
heights = [7900, 8100, 7900, 6900, 9800]
heights = [7900, 8100, 7900, 6900, 9200]

With 9800, the label slips out of the axes:
https://6974-7439715-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/gallery/misc/demo_ribbon_box.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


patch_gradient = BboxImage(ax.bbox, interpolation="bicubic", zorder=0.1)
gradient = np.zeros((2, 2, 4))
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment # background gradient.

Even though the example could use a bit more explanation, I'm not enforcing it as part of this PR, because this is an incremental improvement. However, adding this small comment at least helps to understand what this code segment is about.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just renamed the variable.

- Use AxesImage instead of the more obscure BboxImage.
- Just hardcode the data instead of random-generating it and rounding it
  to hundreds when displaying.
- Misc cleanups.
@timhoffm timhoffm added this to the v3.1.1 milestone May 4, 2019
@timhoffm timhoffm merged commit e64b966 into matplotlib:master May 4, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 4, 2019
@anntzer anntzer deleted the ribbon_box branch May 4, 2019 16:16
dstansby added a commit that referenced this pull request May 4, 2019
…117-on-v3.1.x

Backport PR #14117 on branch v3.1.x (Simplify ribbon_box example.)
@QuLogic QuLogic modified the milestones: v3.1.1, v3.1.0 May 4, 2019
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.

3 participants
0