Skip to content

Legend placement overlaps plot #39

Description

@nmalkin

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)

Activity

  1. nmalkin commented on Oct 8, 2022

    @nmalkin
    OwnerAuthor

    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.)

  2. eliotwrobson commented on Apr 11, 2024

    @eliotwrobson

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions