MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / print_figure

Method print_figure

lib/matplotlib/backend_bases.py:2147–2292  ·  view source on GitHub ↗

Render the figure to hardcopy. Set the figure patch face and edge colors. This is useful because some of the GUIs have a gray figure face color background and you'll probably want to override this on hardcopy. Parameters ---------- filename

(
            self, filename, dpi=None, facecolor=None, edgecolor=None,
            orientation='portrait', format=None, *,
            bbox_inches=None, pad_inches=None, bbox_extra_artists=None,
            backend=None, **kwargs)

Source from the content-addressed store, hash-verified

2145 self.figure.canvas = self
2146
2147 def print_figure(
2148 self, filename, dpi=None, facecolor=None, edgecolor=None,
2149 orientation='portrait', format=None, *,
2150 bbox_inches=None, pad_inches=None, bbox_extra_artists=None,
2151 backend=None, **kwargs):
2152 """
2153 Render the figure to hardcopy. Set the figure patch face and edge
2154 colors. This is useful because some of the GUIs have a gray figure
2155 face color background and you'll probably want to override this on
2156 hardcopy.
2157
2158 Parameters
2159 ----------
2160 filename : str or path-like or file-like
2161 The file where the figure is saved.
2162
2163 dpi : float, default: :rc:`savefig.dpi`
2164 The dots per inch to save the figure in.
2165
2166 facecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.facecolor`
2167 The facecolor of the figure. If 'auto', use the current figure
2168 facecolor.
2169
2170 edgecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.edgecolor`
2171 The edgecolor of the figure. If 'auto', use the current figure
2172 edgecolor.
2173
2174 orientation : {'landscape', 'portrait'}, default: 'portrait'
2175 Only currently applies to PostScript printing.
2176
2177 format : str, optional
2178 Force a specific file format. If not given, the format is inferred
2179 from the *filename* extension, and if that fails from
2180 :rc:`savefig.format`.
2181
2182 bbox_inches : 'tight' or `.Bbox`, default: :rc:`savefig.bbox`
2183 Bounding box in inches: only the given portion of the figure is
2184 saved. If 'tight', try to figure out the tight bbox of the figure.
2185
2186 pad_inches : float or 'layout', default: :rc:`savefig.pad_inches`
2187 Amount of padding in inches around the figure when bbox_inches is
2188 'tight'. If 'layout' use the padding from the constrained or
2189 compressed layout engine; ignored if one of those engines is not in
2190 use.
2191
2192 bbox_extra_artists : list of `~matplotlib.artist.Artist`, optional
2193 A list of extra artists that will be considered when the
2194 tight bbox is calculated.
2195
2196 backend : str, optional
2197 Use a non-default backend to render the file, e.g. to render a
2198 png file with the "cairo" backend rather than the default "agg",
2199 or a pdf file with the "pgf" backend rather than the default
2200 "pdf". Note that the default backend is normally sufficient. See
2201 :ref:`the-builtin-backends` for a list of valid backends for each
2202 file format. Custom backends can be referenced as "module://...".
2203 """
2204 if format is None:

Callers 1

savefigMethod · 0.45

Calls 10

get_default_filetypeMethod · 0.95
_get_rendererFunction · 0.85
restore_bboxFunction · 0.85
_cm_setMethod · 0.80
paddedMethod · 0.80
get_layout_engineMethod · 0.45
drawMethod · 0.45
get_tightbboxMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected