Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ENH]: Specifying figure size based on width and ratio/aspect #28758

Copy link
Copy link
Open
@oscargus

Description

@oscargus
Issue body actions

Problem

While playing around with style files, I realize that for a paper it often makes sense to specify the width (set by the publisher) and ratio (determined by what we plot). Although one can of course read up and remember the figure width etc, it is quite convenient to just use a style file to determine the width and then set the ratio when creating the figure.

Proposed solution

There is https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.set_figheight.html so one way is of course to create the figure using the style file and then set the height suitably.

However, some options are:

set_figratio, basically:

set_figheight(self.get_figwidth()*ratio)

Add a figratio keyword to Figure (and subplots and figure and ...) that takes the width, either from figsize or add a new rcParam for figwidth. Not sure which is less confusing...

(I think one can argue that the width should be kept when modifying the ratio based on the publisher-defined argument.)

Edit: searching a bit more I found https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.figaspect which does the exact opposite to what I want. Maybe an option is to come up with a good name for a similar function that determines the size with fixed width? Although the original idea was to make it "simple".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.