Skip to content

Dedicated artists for inset colorbars, centered-row legends #74

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

Closed
wants to merge 6 commits into from

Conversation

lukelbd
Copy link
Collaborator

@lukelbd lukelbd commented Nov 30, 2019

Centered-row legends and inset colorbars are currently implemented on the Figure and Axes methods with colorbar_wrapper and legend_wrapper. But this means background patch tasks that would be carried out by the Colorbar and Legend classes at draw-time have to be done during call-time.

  • For legend, this may cause hard-to-diagnose display errors if the renderer being used to position the "centered-legend" box changes between legend() call-time and draw-time.
  • For colorbar, we worked around this by severely restricting the bounding box options and estimating the necessary space from font sizes. But it would be much better if the box shape was adjusted dynamically to encompass colorbar contents.

This PR will create dedicated classes for inset colorbars and centered-row legends so the background patch extent can be determined dynamically at draw-time.

Also, while starting this PR I learned about some intriguing matplotlib classes in the offsetbox module used to automatically position legend labels / text. The HPacker and VPacker classes might be used to implement #46 / #50. Anchored artists might also be useful for both PRs.

@lukelbd lukelbd changed the title Dedicated classes for inset colorbars, centered-row legends, ... Dedicated classes for inset colorbars, centered-row legends Nov 30, 2019
@lukelbd lukelbd changed the title Dedicated classes for inset colorbars, centered-row legends Dedicated artists for inset colorbars, centered-row legends Nov 30, 2019
@lukelbd
Copy link
Collaborator Author

lukelbd commented Oct 12, 2021

This branch is too out of date to merge. But it is the next item on the to-do list so will be implemented before long (by the end of the year).

@lukelbd lukelbd closed this Oct 12, 2021
@lukelbd lukelbd deleted the legend-colorbar-classes branch October 12, 2021 05:51
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.

1 participant