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

ax.get_legend_handles_labels() returns emtpy lists #14

Open
brandonlind opened this issue Nov 26, 2021 · 0 comments
Open

ax.get_legend_handles_labels() returns emtpy lists #14

brandonlind opened this issue Nov 26, 2021 · 0 comments

Comments

@brandonlind
Copy link

brandonlind commented Nov 26, 2021

I'd like to change the number of columns in the legend so that there is only one row (ncol = number of groups).

To do so I thought I could take the ax returned from venn and use the method .get_legend_handles_labels() which I could pass to ax.legend to also specify ncol. However, ax.get_legend_handles_labels() returns two empty lists, which when passed to ax.legend cause the legend to disappear.

musicians = {
    "Members of The Beatles": {"Paul McCartney", "John Lennon", "George Harrison", "Ringo Starr"},
    "Guitarists": {"John Lennon", "George Harrison", "Jimi Hendrix", "Eric Clapton", "Carlos Santana"},
    "Played at Woodstock": {"Jimi Hendrix", "Carlos Santana", "Keith Moon"}
}
ax = venn(musicians)
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles, labels, ncol=3)

Screen Shot 2021-11-26 at 11 26 06 AM

The potential work-around is to just pass the keys of the dictionary musicians to ax.legend and also specify ncol (this produces a figure as expected), but still not sure why ax.get_legend_handles_labels() doesn't work.

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

No branches or pull requests

1 participant