Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

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

Open
@oscargus

Description

@oscargus

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 ishttps://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 afigratio keyword to Figure (and subplots and figure and ...) that takes the width, either fromfigsize 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 foundhttps://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


      [8]ページ先頭

      ©2009-2025 Movatter.jp