Skip to content

Feature Request: Automatic Legend Placement Outside of Figures and Axesย #3745

Closed
@Void2258

Description

@Void2258

The need to place a legend outside of the axes is very common, particularly if graphing unpredictable data. It is also an issue when data is dense enough that there is no clear space on the graph to place the legend. While we have a simple system for positioning the legend within the axes, positioning them outside the axes is an exercise in frustration.

Currently, in order to place a legend outside of a figure, a complicated manual positioning procedure is needed, involving manipulation of bbox_to_anchor as well as axes and figure size and positioning. This method requires extensive trial and error. Further, this manual work must be repeated anytime the graph size or shape must be changed. On a large number of projects, I personally have spent more time getting the legend and the graph sizing to cooperate when I must place the legend outside than on the rest of the project COMBINED (often requiring the writing of separate code just to test this without having to run the rest of the project over and over), and I have heard similar stories from many other people.

To place a legend inside the axes we have a simple location system wherein we simply set the loc parameter, which requires only so much trial and error as looking at a couple different locations at most, and requires no added work on changing the size and shape of the graph. Can this system be extended to allow for automatic positioning of the legend outside the axes?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions