Skip to content
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

Allow multiple legends #145

Open
ResidentMario opened this issue Jul 5, 2019 · 0 comments
Open

Allow multiple legends #145

ResidentMario opened this issue Jul 5, 2019 · 0 comments
Labels

Comments

@ResidentMario
Copy link
Owner

A long-requested feature (see e.g. #32) (probably the second most asked-for feature, after built-in webmaps) is the ability to have multiple legends on a single plot. E.g. if a plot uses both hue and scale visual variables, it makes sense to have both a hue and a scale legend. However, currently only a single legend for one or the other is allowed—not both.

matplotlib allows creating multiple legends on the same axis, with some reservations. Some trickiness that comes up when considering implementing this feature:

  • What to do if one legend is a colorbar legend and the other a regular legend?

  • What happens if we add a third visual variable to the plot in the future? How would our handing of legends adapt?

  • How would this interact with the legend and legend_var parameters?

  • It appears that legend positions cannot be inferred automatically more than once:

    Sometimes it is more clear to split legend entries across multiple legends. Whilst the instinctive approach to doing this might be to call the legend() function multiple times, you will find that only one legend ever exists on the Axes. This has been done so that it is possible to call legend() repeatedly to update the legend to the latest handles on the Axes, so to persist old legend instances, we must add them manually to the Axes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant