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

constrained layout guide typos#10367

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes fromall 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
24 changes: 12 additions & 12 deletionstutorials/intermediate/constrainedlayout_guide.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@
How to use constrained-layout to fit plots within your figure cleanly.

*constrained_layout* automatically adjusts subplots and decorations like
legends and colorbars so that they fit in the figure windowwihile still
legends and colorbars so that they fit in the figure windowwhile still
preserving, as best they can, the logical layout requested by the user.

*constrained_layout* is similar to *tight_layout*, but uses a constraint
Expand All@@ -24,7 +24,7 @@
Simple Example
==============

Inmatplotlib, the location of axes (including subplots) are specified in
InMatplotlib, the location of axes (including subplots) are specified in
normalized figure coordinates. It can happen that your axis labels or
titles (or sometimes even ticklabels) go outside the figure area, and are thus
clipped.
Expand DownExpand Up@@ -152,7 +152,7 @@ def example_plot(ax, fontsize=12, nodec=False):
# Padding and Spacing
# ===================
#
# For constrained_layout, we haveimplimented a padding around the edge of
# For constrained_layout, we haveimplemented a padding around the edge of
# each axes. This padding sets the distance from the edge of the plot,
# and the minimum distance between adjacent plots. It is specified in
# inches by the keyword arguments `w_pad` and `h_pad` to the function
Expand DownExpand Up@@ -234,7 +234,7 @@ def example_plot(ax, fontsize=12, nodec=False):
# - `w_pad`, `h_pad` Padding around axes objects.
# Float representing inches. Default is 3./72. inches (3 pts)
# - `wspace`, `hspace` Space between subplot groups.
# Float representing a fraction of thesuplot widths being separated.
# Float representing a fraction of thesubplot widths being separated.
# Default is 0.02.

plt.rcParams['figure.constrained_layout.use'] = True
Expand DownExpand Up@@ -472,7 +472,7 @@ def docomplicated(suptitle=None):
# https://github.com/matplotlib/matplotlib/issues.
#
# If there is a bug, please report with a self-contained example that does
# not require outside data or dependencies (other thanperhapsnumpy).
# not require outside data or dependencies (other than numpy).

###########################################################
# Notes on the algorithm
Expand DownExpand Up@@ -515,7 +515,7 @@ def docomplicated(suptitle=None):
# `ax.position`, which sets where in the figure the spines are placed.
#
# Why so many stacked containers? Ideally, all that would be needed are the
# Axeslayotu boxes. For the Gridspec case, a container is
# Axeslayout boxes. For the Gridspec case, a container is
# needed if the Gridspec is nested via `~.GridSpecFromSubplotSpec`. At the
# top level, it is desirable for symmetry, but it also makes room for
# `~.Figure.suptitle`.
Expand All@@ -529,8 +529,8 @@ def docomplicated(suptitle=None):
# ---------------------
#
# For a single Axes the layout is straight forward. The Figure and
# outer Gridspec layoutboxesco-incide. The Subplotspec and Axes
# boxes alsoco-incide because the Axes has no colorbar. Note
# outer Gridspec layoutboxescoincide. The Subplotspec and Axes
# boxes alsocoincide because the Axes has no colorbar. Note
# the difference between the red ``pos`` box and the green ``ax`` box
# is set by the size of the decorations around the Axes.
#
Expand DownExpand Up@@ -584,7 +584,7 @@ def docomplicated(suptitle=None):
#
# Adding a colorbar makes it clear why the Subplotspec layoutboxes must
# be different from the axes layoutboxes. Here we see the left-hand
# subplotspec has more room toaccomodate the `~.Figure.colorbar`, and
# subplotspec has more room toaccommodate the `~.Figure.colorbar`, and
# that there are two green ``ax`` boxes inside the ``ss`` box.
#
# Note that the width of the ``pos`` boxes is still the same because of the
Expand DownExpand Up@@ -629,7 +629,7 @@ def docomplicated(suptitle=None):
# The first method is used here. The constraint that makes the heights
# be correct is in the code where ``drowsC < drows0`` which in
# this case would be 1 is less than 2. So we constrain the
#theheight of the 1-row Axes to be less than half the height of the
# height of the 1-row Axes to be less than half the height of the
# 2-row Axes.
#
# ..note::
Expand All@@ -650,7 +650,7 @@ def docomplicated(suptitle=None):
plot_children(fig, fig._layoutbox, printit=False)

#######################################################################
# Height and width ratios areaccomodated with the same part of
# Height and width ratios areaccommodated with the same part of
# the code with the smaller axes always constrained to be less in size
# than the larger.

Expand All@@ -675,7 +675,7 @@ def docomplicated(suptitle=None):
# The final piece of the code that has not been explained is what happens if
# there is an empty gridspec opening. In that case a fake invisible axes is
# added and we proceed as before. The empty gridspec has no decorations, but
# the axespostion in made the same size as the occupied Axes positions.
# the axesposition in made the same size as the occupied Axes positions.
#
# This is done at the start of
# `~._constrained_layout.do_constrained_layout` (``hassubplotspec``).
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp