mpl.pyplot.Figure.add_subplot

Figure.add_subplot(*args, **kwargs)[source]

Add a subplot. Examples:

fig.add_subplot(111)

# equivalent but more general
fig.add_subplot(1,1,1)

# add subplot with red background
fig.add_subplot(212, axisbg='r')

# add a polar subplot
fig.add_subplot(111, projection='polar')

# add Subplot instance sub
fig.add_subplot(sub)

kwargs are legal Axes kwargs plus projection, which chooses a projection type for the axes. (For backward compatibility, polar=True may also be provided, which is equivalent to projection=’polar’). Valid values for projection are: [u’aitoff’, u’hammer’, u’lambert’, u’mollweide’, u’polar’, u’rectilinear’]. Some of these projections support additional kwargs, which may be provided to add_axes().

The Axes instance will be returned.

If the figure already has a subplot with key (args, kwargs) then it will simply make that subplot current and return it.

See also

subplot() for an explanation of the args.

The following kwargs are supported:

adjustable: [ ‘box’ | ‘datalim’ | ‘box-forced’] agg_filter: unknown alpha: float (0.0 transparent through 1.0 opaque) anchor: unknown animated: [True | False] aspect: unknown autoscale_on: unknown autoscalex_on: unknown autoscaley_on: unknown axes: an Axes instance axes_locator: unknown axis_bgcolor: any matplotlib color - see colors() axisbelow: [ True | False ] clip_box: a matplotlib.transforms.Bbox instance clip_on: [True | False] clip_path: [ (Path, Transform) | Patch | None ] color_cycle: unknown contains: a callable function figure: unknown frame_on: [ True | False ] gid: an id string label: string or anything printable with ‘%s’ conversion. navigate: [ True | False ] navigate_mode: unknown path_effects: unknown picker: [None|float|boolean|callable] position: unknown rasterization_zorder: unknown rasterized: [True | False | None] sketch_params: unknown snap: unknown title: unknown transform: Transform instance url: a url string visible: [True | False] xbound: unknown xlabel: unknown xlim: length 2 sequence of floats xmargin: unknown xscale: [u’linear’ | u’log’ | u’logit’ | u’symlog’] xticklabels: sequence of strings xticks: sequence of floats ybound: unknown ylabel: unknown ylim: length 2 sequence of floats ymargin: unknown yscale: [u’linear’ | u’log’ | u’logit’ | u’symlog’] yticklabels: sequence of strings yticks: sequence of floats zorder: any number