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

Update figure.py #29277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
Loading
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion 38 lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3219,7 +3219,43 @@
matplotlib.figure.Figure.set_size_inches
"""
self.set_size_inches(self.get_figwidth(), val, forward=forward)

def set_figratio(self, width=None, height=None, aspect=None, forward=True):

Check failure on line 3222 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E301 expected 1 blank line, found 0 Raw Output: ./lib/matplotlib/figure.py:3222:5: E301 expected 1 blank line, found 0
"""

Check failure on line 3223 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E112 expected an indented block Raw Output: ./lib/matplotlib/figure.py:3223:5: E112 expected an indented block

Check failure on line 3223 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E999 IndentationError: expected an indented block after function definition on line 3222 Raw Output: ./lib/matplotlib/figure.py:3223:6: E999 IndentationError: expected an indented block after function definition on line 3222
Set the size of the figure using a width, height, or aspect ratio.
Parameters
----------
width : float, optional
The width of the figure in inches. If None, the width is taken from rcParams["figure.figsize"].

Check failure on line 3228 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E501 line too long (103 > 88 characters) Raw Output: ./lib/matplotlib/figure.py:3228:89: E501 line too long (103 > 88 characters)
height : float, optional
The height of the figure in inches. If None, the height is taken from rcParams["figure.figsize"].

Check failure on line 3230 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E501 line too long (105 > 88 characters) Raw Output: ./lib/matplotlib/figure.py:3230:89: E501 line too long (105 > 88 characters)
aspect : float, optional
The aspect ratio to adjust the size. If set, the height or width will be adjusted accordingly.

Check failure on line 3232 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E501 line too long (102 > 88 characters) Raw Output: ./lib/matplotlib/figure.py:3232:89: E501 line too long (102 > 88 characters)
forward : bool, optional
See `set_size_inches` for details.

Check failure on line 3235 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 W293 blank line contains whitespace Raw Output: ./lib/matplotlib/figure.py:3235:1: W293 blank line contains whitespace
Raises
------
ValueError
If neither width nor height nor aspect is provided.
"""
figsize_default = plt.rcParams["figure.figsize"]

if width is not None and height is not None:
self.set_size_inches(width, height, forward=forward)
elif aspect is not None:
if height is not None:
self.set_size_inches(self.get_figwidth() * aspect, height, forward=forward)
elif width is not None:
self.set_size_inches(width, self.get_figheight() * aspect, forward=forward)
else:
self.set_size_inches(self.get_figwidth() * aspect, self.get_figheight() * aspect, forward=forward)

Check failure on line 3251 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E501 line too long (110 > 88 characters) Raw Output: ./lib/matplotlib/figure.py:3251:89: E501 line too long (110 > 88 characters)
else:
if width is None:
width = figsize_default[0]

Check failure on line 3254 in lib/matplotlib/figure.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 W291 trailing whitespace Raw Output: ./lib/matplotlib/figure.py:3254:39: W291 trailing whitespace
if height is None:
height = figsize_default[1]
self.set_size_inches(width, height, forward=forward)

def clear(self, keep_observers=False):
# docstring inherited
super().clear(keep_observers=keep_observers)
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.