Skip to content

matplotlib - make figure.autolayout the default? #8578

Closed
@Tom-Willemsen

Description

@Tom-Willemsen

Feature Description

As a user I'd like matplotlib plots to make an attempt to display all information that has been plotted, even if the plot is quite small.

This can already be done with matplotlib rcParams global configuration which all mpl plots obey, e.g.:

import matplotlib
matplotlib.rcParams["figure.autolayout"] = True
matplotlib.rcParams["font.size"] = 8

Font size setting is just to give the plots a bit more space when stacked 3-up vertically, gives a comparable font size to scripting window. figure.autolayout gets matplotlib to attempt to squeeze the plot into the available space, generally it does an ok job.

Consider whether we want the GUI to set these, or similar, matplotlib params by default at startup - or whether we push this responsibility down to beamline-level configuration.

Advantages:

  • most plots will display sensibly with minimal end-user configuration

Disadvantages:

  • Might be surprising to some users if we override mpl's own defaults.
    • Counterargument: we know that our plot windows will regularly end up quite small compared to "normal" mpl backends, so maybe an explicit non-default configuration is justifiable.
  • If we're not careful about doing this early enough we might accidentally overwrite beamline-local configuration that has already been done by scientists
    • Even if we don't overwrite keys which they've set in rcParams, we might be conflicting with explicit layouts they've set up. But I don't know how common (if at all) that is in practice.

Explanation

Consider whether we want the GUI to set these matplotlib params by default at startup.

Additional Information

Consider whether we want the GUI to set these matplotlib params by default at startup.

Acceptance Criteria

  • Consider whether we want the GUI to set these matplotlib params by default at startup.

How to Review

  • Has the developer considered whether we want the GUI to set these matplotlib params by default at startup.

Time in recording of planning meeting: 00h36m 2024/11/28
planning 00:04 2025/03/06

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions