figure¶
- figure(**kwargs)[source]¶
Create an empty figure. Subplots can be subsequently added using
add_subplot
orsubplots
. This command is analogous tomatplotlib.pyplot.figure
.- Parameters
refnum (
int
, optional) – The reference subplot number. Therefwidth
,refheight
, andrefaspect
keyword args are applied to this subplot, and the aspect ratio is conserved for this subplot in theauto_layout
. The default is the first subplot created in the figure.refaspect (
float
or2-tuple
offloat
, optional) – The reference subplot aspect ratio. If scalar, this indicates the width divided by height. If 2-tuple, this indicates the (width, height). Ignored if bothfigwidth
andfigheight
or bothrefwidth
andrefheight
were passed. The default value is1
or the “data aspect ratio” if the latter is explicitly fixed (as withimshow
plots andGeoAxes
projections; seeset_aspect
).refwidth, refheight (
unit-spec
, default:rc['subplots.refwidth']
=2.5
) – The width, height of the reference subplot. If float, units are inches. If string, interpreted byunits
. Ignored iffigwidth
,figheight
, orfigsize
was passed. If you specify just one,refaspect
will be respected.ref, aspect, axwidth, axheight – Aliases for
refnum
,refaspect
,refwidth
,refheight
. These may be deprecated in a future release.figwidth, figheight (
unit-spec
, optional) – The figure width and height. Default behavior is to userefwidth
. If float, units are inches. If string, interpreted byunits
. If you specify just one,refaspect
will be respected.width, height – Aliases for
figwidth
,figheight
.figsize (
2-tuple
, optional) – Tuple specifying the figure(width, height)
.sharex, sharey, share (
{0, False, 1, 'labels', 'labs', 2, 'limits', 'lims', 3, True, 4, 'all'}
, default:rc['subplots.share']
=True
) – The axis sharing “level” for the x axis, y axis, or both axes. Options are as follows:0
orFalse
: No axis sharing. This also sets the defaultspanx
andspany
values toFalse
.1
or'labels'
or'labs'
: Only draw axis labels on the bottommost row or leftmost column of subplots. Tick labels still appear on every subplot.2
or'limits'
or'lims'
: As above but force the axis limits, scales, and tick locations to be identical. Tick labels still appear on every subplot.3
orTrue
: As above but only show the tick labels on the bottommost row and leftmost column of subplots.4
or'all'
: As above but also share the axis limits, scales, and tick locations between subplots not in the same row or column.
spanx, spany, span (
bool
or{0, 1}
, default:rc['subplots.span']
=True
) – Whether to use “spanning” axis labels for the x axis, y axis, or both axes. Default isFalse
ifsharex
,sharey
, orshare
are0
orFalse
. WhenTrue
, a single, centered axis label is used for all axes with bottom and left edges in the same row or column. This can considerably redundancy in your figure. “Spanning” labels integrate with “shared” axes. For example, for a 3-row, 3-column figure, withsharey > 1
andspany == True
, your figure will have 1 y axis label instead of 9 y axis labels.alignx, aligny, align (
bool
or{0, 1}
, default:rc['subplots.align']
=False
) – Whether to “align” axis labels for the x axis, y axis, or both axes. Aligned labels always appear in the same row or column. This is ignored ifspanx
,spany
, orspan
areTrue
.left, right, top, bottom (
unit-spec
, default:None
) – The fixed space between the subplots and the figure edge. If float, units are em-widths. If string, interpreted byunits
. IfNone
, the space is determined automatically based on the tick and label settings. Ifrc['subplots.tight']
isTrue
ortight=True
was passed to the figure, the space is determined by the tight layout algorithm.wspace, hspace, space (
unit-spec
, default:None
) – The fixed space between grid columns, rows, or both. If float, units are em-widths. If string, interpreted byunits
. IfNone
, the space is determined automatically based on the font size and axis sharing settings. Ifrc['subplots.tight']
isTrue
ortight=True
was passed to the figure, the space is determined by the tight layout algorithm.tight (
bool
, default::rc`subplots.tight`
) – Whether automatic calls toauto_layout
should include tight layout adjustments. If you manually specified a spacing in the call tosubplots
, it will be used to override the tight layout spacing. For example, withleft=1
, the left margin is set to 1 em-width, while the remaining margin widths are calculated automatically.wequal, hequal, equal (
bool
, default:rc['subplots.equalspace']
=False
) – Whether to make the tight layout algorithm apply equal spacing between columns, rows, or both.wgroup, hgroup, group (
bool
, default:rc['subplots.groupspace']
=True
) – Whether to make the tight layout algorithm just consider spaces between adjacent subplots instead of entire columns and rows of subplots.outerpad (
unit-spec
, default:rc['subplots.outerpad']
=0.5
) – The scalar tight layout padding around the left, right, top, bottom figure edges. If float, units are em-widths. If string, interpreted byunits
.innerpad (
unit-spec
, default:rc['subplots.innerpad']
=1.0
) – The scalar tight layout padding between columns and rows. Synonymous withpad
. If float, units are em-widths. If string, interpreted byunits
.panelpad (
unit-spec
, default:rc['subplots.panelpad']
=0.5
) – The scalar tight layout padding between subplots and their panels, colorbars, and legends and between “stacks” of these objects. If float, units are em-widths. If string, interpreted byunits
.journal (
str
, optional) – String corresponding to an academic journal standard used to control the figure widthfigwidth
and, if specified, the figure heightfigheight
. See the below table. Feel free to add to this table by submitting a pull request.Key
Size description
Organization
'aaas1'
1-column
American Association for the Advancement of Science (e.g. Science)
'aaas2'
2-column
”
'agu1'
1-column
'agu2'
2-column
”
'agu3'
full height 1-column
”
'agu4'
full height 2-column
”
'ams1'
1-column
'ams2'
small 2-column
”
'ams3'
medium 2-column
”
'ams4'
full 2-column
”
'nat1'
1-column
'nat2'
2-column
”
'pnas1'
1-column
'pnas2'
2-column
”
'pnas3'
landscape page
”
- Other Parameters
**kwargs – Passed to
proplot.figure.Figure.format
.