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