@@ -2837,10 +2837,11 @@ def savefig(self, fname, *, transparent=None, **kwargs):
2837
2837
2838
2838
Call signature::
2839
2839
2840
- savefig(fname, dpi=None, facecolor='w', edgecolor='w',
2841
- orientation='portrait', papertype=None, format=None,
2842
- transparent=False, bbox_inches=None, pad_inches=0.1,
2843
- frameon=None, metadata=None)
2840
+ savefig(fname, *, dpi='figure', format=None, metadata=None,
2841
+ bbox_inches=None, pad_inches=0.1,
2842
+ facecolor='auto', edgecolor='auto',
2843
+ backend=None, **kwargs
2844
+ )
2844
2845
2845
2846
The available output formats depend on the backend being used.
2846
2847
@@ -2868,6 +2869,29 @@ def savefig(self, fname, *, transparent=None, **kwargs):
2868
2869
The resolution in dots per inch. If 'figure', use the figure's
2869
2870
dpi value.
2870
2871
2872
+ format : str
2873
+ The file format, e.g. 'png', 'pdf', 'svg', ... The behavior when
2874
+ this is unset is documented under *fname*.
2875
+
2876
+ metadata : dict, optional
2877
+ Key/value pairs to store in the image metadata. The supported keys
2878
+ and defaults depend on the image format and backend:
2879
+
2880
+ - 'png' with Agg backend: See the parameter ``metadata`` of
2881
+ `~.FigureCanvasAgg.print_png`.
2882
+ - 'pdf' with pdf backend: See the parameter ``metadata`` of
2883
+ `~.backend_pdf.PdfPages`.
2884
+ - 'svg' with svg backend: See the parameter ``metadata`` of
2885
+ `~.FigureCanvasSVG.print_svg`.
2886
+ - 'eps' and 'ps' with PS backend: Only 'Creator' is supported.
2887
+
2888
+ bbox_inches : str or `.Bbox`, default: :rc:`savefig.bbox`
2889
+ Bounding box in inches: only the given portion of the figure is
2890
+ saved. If 'tight', try to figure out the tight bbox of the figure.
2891
+
2892
+ pad_inches : float, default: :rc:`savefig.pad_inches`
2893
+ Amount of padding around the figure when bbox_inches is 'tight'.
2894
+
2871
2895
facecolor : color or 'auto', default: :rc:`savefig.facecolor`
2872
2896
The facecolor of the figure. If 'auto', use the current figure
2873
2897
facecolor.
@@ -2876,6 +2900,14 @@ def savefig(self, fname, *, transparent=None, **kwargs):
2876
2900
The edgecolor of the figure. If 'auto', use the current figure
2877
2901
edgecolor.
2878
2902
2903
+ backend : str, optional
2904
+ Use a non-default backend to render the file, e.g. to render a
2905
+ png file with the "cairo" backend rather than the default "agg",
2906
+ or a pdf file with the "pgf" backend rather than the default
2907
+ "pdf". Note that the default backend is normally sufficient. See
2908
+ :ref:`the-builtin-backends` for a list of valid backends for each
2909
+ file format. Custom backends can be referenced as "module://...".
2910
+
2879
2911
orientation : {'landscape', 'portrait'}
2880
2912
Currently only supported by the postscript backend.
2881
2913
@@ -2884,57 +2916,30 @@ def savefig(self, fname, *, transparent=None, **kwargs):
2884
2916
'a10', 'b0' through 'b10'. Only supported for postscript
2885
2917
output.
2886
2918
2887
- format : str
2888
- The file format, e.g. 'png', 'pdf', 'svg', ... The behavior when
2889
- this is unset is documented under *fname*.
2890
-
2891
2919
transparent : bool
2892
2920
If *True*, the Axes patches will all be transparent; the
2893
- Figure patch will also be transparent unless facecolor
2894
- and/or edgecolor are specified via kwargs.
2921
+ Figure patch will also be transparent unless * facecolor*
2922
+ and/or * edgecolor* are specified via kwargs.
2895
2923
2896
- If *False* has no effect and leaves the color of the Axes and
2897
- Figure patches as they are.
2924
+ If *False* has no effect and the color of the Axes and
2925
+ Figure patches are unchanged (unless the Figure patch
2926
+ is specified via the *facecolor* and/or *edgecolor* keyword
2927
+ arguments in which case those colors are used).
2898
2928
2899
- This is useful, for example, for displaying
2900
- a plot on top of a colored background on a web page. The
2901
- transparency of these patches will be restored to their
2929
+ The transparency of these patches will be restored to their
2902
2930
original values upon exit of this function.
2903
2931
2904
- bbox_inches : str or `.Bbox`, default: :rc:`savefig.bbox`
2905
- Bounding box in inches: only the given portion of the figure is
2906
- saved. If 'tight', try to figure out the tight bbox of the figure.
2907
-
2908
- pad_inches : float, default: :rc:`savefig.pad_inches`
2909
- Amount of padding around the figure when bbox_inches is 'tight'.
2932
+ This is useful, for example, for displaying
2933
+ a plot on top of a colored background on a web page.
2910
2934
2911
2935
bbox_extra_artists : list of `~matplotlib.artist.Artist`, optional
2912
2936
A list of extra artists that will be considered when the
2913
2937
tight bbox is calculated.
2914
2938
2915
- backend : str, optional
2916
- Use a non-default backend to render the file, e.g. to render a
2917
- png file with the "cairo" backend rather than the default "agg",
2918
- or a pdf file with the "pgf" backend rather than the default
2919
- "pdf". Note that the default backend is normally sufficient. See
2920
- :ref:`the-builtin-backends` for a list of valid backends for each
2921
- file format. Custom backends can be referenced as "module://...".
2922
-
2923
- metadata : dict, optional
2924
- Key/value pairs to store in the image metadata. The supported keys
2925
- and defaults depend on the image format and backend:
2926
-
2927
- - 'png' with Agg backend: See the parameter ``metadata`` of
2928
- `~.FigureCanvasAgg.print_png`.
2929
- - 'pdf' with pdf backend: See the parameter ``metadata`` of
2930
- `~.backend_pdf.PdfPages`.
2931
- - 'svg' with svg backend: See the parameter ``metadata`` of
2932
- `~.FigureCanvasSVG.print_svg`.
2933
- - 'eps' and 'ps' with PS backend: Only 'Creator' is supported.
2934
-
2935
2939
pil_kwargs : dict, optional
2936
2940
Additional keyword arguments that are passed to
2937
2941
`PIL.Image.Image.save` when saving the figure.
2942
+
2938
2943
"""
2939
2944
2940
2945
kwargs .setdefault ('dpi' , mpl .rcParams ['savefig.dpi' ])
0 commit comments