1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
|
*********************
``matplotlib.figure``
*********************
.. currentmodule:: matplotlib.figure
.. automodule:: matplotlib.figure
:no-members:
:no-undoc-members:
Figure
======
Figure class
------------
.. autosummary::
:toctree: _as_gen
:template: autosummary_class_only.rst
:nosignatures:
Figure
Adding Axes and SubFigures
--------------------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.add_axes
Figure.add_subplot
Figure.subplots
Figure.subplot_mosaic
Figure.add_gridspec
Figure.get_axes
Figure.axes
Figure.delaxes
Figure.subfigures
Figure.add_subfigure
Saving
------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.savefig
Annotating
----------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.colorbar
Figure.legend
Figure.text
Figure.suptitle
Figure.get_suptitle
Figure.supxlabel
Figure.get_supxlabel
Figure.supylabel
Figure.get_supylabel
Figure.align_labels
Figure.align_xlabels
Figure.align_ylabels
Figure.align_titles
Figure.autofmt_xdate
Figure geometry
---------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.set_size_inches
Figure.get_size_inches
Figure.set_figheight
Figure.get_figheight
Figure.set_figwidth
Figure.get_figwidth
Figure.dpi
Figure.set_dpi
Figure.get_dpi
Subplot layout
--------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.subplots_adjust
Figure.set_layout_engine
Figure.get_layout_engine
Discouraged or deprecated
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.tight_layout
Figure.set_tight_layout
Figure.get_tight_layout
Figure.set_constrained_layout
Figure.get_constrained_layout
Figure.set_constrained_layout_pads
Figure.get_constrained_layout_pads
Interactive
-----------
.. seealso::
- :ref:`event-handling`
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.ginput
Figure.add_axobserver
Figure.waitforbuttonpress
Figure.pick
Modifying appearance
--------------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.set_frameon
Figure.get_frameon
Figure.set_linewidth
Figure.get_linewidth
Figure.set_facecolor
Figure.get_facecolor
Figure.set_edgecolor
Figure.get_edgecolor
Adding and getting Artists
--------------------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.add_artist
Figure.get_children
Figure.figimage
Getting and modifying state
---------------------------
.. seealso::
- :ref:`interactive_figures`
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
Figure.clear
Figure.gca
Figure.sca
Figure.get_tightbbox
Figure.get_window_extent
Figure.show
Figure.set_canvas
Figure.draw
Figure.draw_without_rendering
Figure.draw_artist
.. _figure-api-subfigure:
SubFigure
=========
Matplotlib has the concept of a `~.SubFigure`, which is a logical figure inside
a parent `~.Figure`. It has many of the same methods as the parent. See
:ref:`nested_axes_layouts`.
.. plot::
fig = plt.figure(layout='constrained', figsize=(4, 2.5), facecolor='lightgoldenrodyellow')
# Make two subfigures, left ones more narrow than right ones:
sfigs = fig.subfigures(1, 2, width_ratios=[0.8, 1])
sfigs[0].set_facecolor('khaki')
sfigs[1].set_facecolor('lightsalmon')
# Add subplots to left subfigure:
lax = sfigs[0].subplots(2, 1)
sfigs[0].suptitle('Left subfigure')
# Add subplots to right subfigure:
rax = sfigs[1].subplots(1, 2)
sfigs[1].suptitle('Right subfigure')
# suptitle for the main figure:
fig.suptitle('Figure')
SubFigure class
---------------
.. autosummary::
:toctree: _as_gen
:template: autosummary_class_only.rst
:nosignatures:
SubFigure
Adding Axes and SubFigures
--------------------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
SubFigure.add_axes
SubFigure.add_subplot
SubFigure.subplots
SubFigure.subplot_mosaic
SubFigure.add_gridspec
SubFigure.delaxes
SubFigure.add_subfigure
SubFigure.subfigures
Annotating
----------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
SubFigure.colorbar
SubFigure.legend
SubFigure.text
SubFigure.suptitle
SubFigure.get_suptitle
SubFigure.supxlabel
SubFigure.get_supxlabel
SubFigure.supylabel
SubFigure.get_supylabel
SubFigure.align_labels
SubFigure.align_xlabels
SubFigure.align_ylabels
SubFigure.align_titles
Adding and getting Artists
--------------------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
SubFigure.add_artist
SubFigure.get_children
Modifying appearance
--------------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
SubFigure.set_frameon
SubFigure.get_frameon
SubFigure.set_linewidth
SubFigure.get_linewidth
SubFigure.set_facecolor
SubFigure.get_facecolor
SubFigure.set_edgecolor
SubFigure.get_edgecolor
Passthroughs
------------
.. autosummary::
:toctree: _as_gen
:template: autosummary.rst
:nosignatures:
SubFigure.set_dpi
SubFigure.get_dpi
FigureBase parent class
=======================
.. autoclass:: FigureBase
Helper functions
================
.. autofunction:: figaspect
|