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

Legend placement overlaps plot #39

Open
nmalkin opened this issue Oct 8, 2022 · 2 comments
Open

Legend placement overlaps plot #39

nmalkin opened this issue Oct 8, 2022 · 2 comments

Comments

@nmalkin
Copy link
Owner

nmalkin commented Oct 8, 2022

By the way, this is how a Plot looks finally. Somehow the legend is shifted into the plotting canvas. If someone has a solution for that as well?!

question_B222

Originally posted by @hbxbgrw7913 in #37 (comment)

@nmalkin
Copy link
Owner Author

nmalkin commented Oct 8, 2022

The positioning of the legend is fairly straightforward to control:

axes = plot_likert.plot_likert(df, scale)

legend = axes.get_legend()
legend.set_bbox_to_anchor((1.5, 1))  # or whatever

This might be a good thing to add to the user guide. (PRs welcome until I get to it myself).

Another option might be to allow passing in additional arguments for the legend, as is done, for example, in 533b570 in a fork. I'm reluctant to add features that don't seem strictly necessary, but I'm curious if there's a lot of demand for this.

(This is all side-stepping the question of why the legend's placement is off in the first place. I don't know the answer to that, but I'm inclined to keep the default behavior rather than trying to second-guess matplotlib.)

@eliotwrobson
Copy link

I think this should be added to the examples as well, being able to control the position of the legend is super useful for generating plots in publications with page limits / other space restrictions.

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

2 participants