Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c1d1c9

Browse files
authored
Merge pull request #15348 from timhoffm/doc-savefig
Some figure and related docs cleanup
2 parents fb86190 + 6d48837 commit 2c1d1c9

File tree

4 files changed

+43
-46
lines changed

4 files changed

+43
-46
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,8 +2004,8 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
20042004
orientation : {'landscape', 'portrait'}, optional
20052005
only currently applies to PostScript printing.
20062006
2007-
dpi : scalar, optional
2008-
the dots per inch to save the figure in; if None, use savefig.dpi
2007+
dpi : float, default: :rc:`savefig.dpi`
2008+
The dots per inch to save the figure in.
20092009
20102010
facecolor : color or None, optional
20112011
the facecolor of the figure; if None, defaults to savefig.facecolor

lib/matplotlib/backends/backend_agg.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -561,20 +561,18 @@ def print_jpg(self, filename_or_obj, *args, dryrun=False,
561561
562562
Other Parameters
563563
----------------
564-
quality : int
565-
The image quality, on a scale from 1 (worst) to 100 (best).
566-
The default is :rc:`savefig.jpeg_quality`. Values above
567-
95 should be avoided; 100 completely disables the JPEG
568-
quantization stage.
569-
570-
optimize : bool
571-
If present, indicates that the encoder should
572-
make an extra pass over the image in order to select
573-
optimal encoder settings.
574-
575-
progressive : bool
576-
If present, indicates that this image
577-
should be stored as a progressive JPEG file.
564+
quality : int, default: :rc:`savefig.jpeg_quality`
565+
The image quality, on a scale from 1 (worst) to 95 (best).
566+
Values above 95 should be avoided; 100 disables portions of
567+
the JPEG compression algorithm, and results in large files
568+
with hardly any gain in image quality.
569+
570+
optimize : bool, default: False
571+
Whether the encoder should make an extra pass over the image
572+
in order to select optimal encoder settings.
573+
574+
progressive : bool, default: False
575+
Whether the image should be stored as a progressive JPEG file.
578576
579577
pil_kwargs : dict, optional
580578
Additional keyword arguments that are passed to

lib/matplotlib/figure.py

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ def add_axes(self, *args, **kwargs):
11301130
a custom projection, see `~matplotlib.projections`. The default
11311131
None results in a 'rectilinear' projection.
11321132
1133-
polar : boolean, optional
1133+
polar : bool, default: False
11341134
If True, equivalent to projection='polar'.
11351135
11361136
sharex, sharey : `~.axes.Axes`, optional
@@ -1280,7 +1280,7 @@ def add_subplot(self, *args, **kwargs):
12801280
name of a custom projection, see `~matplotlib.projections`. The
12811281
default None results in a 'rectilinear' projection.
12821282
1283-
polar : boolean, optional
1283+
polar : bool, default: False
12841284
If True, equivalent to projection='polar'.
12851285
12861286
sharex, sharey : `~.axes.Axes`, optional
@@ -2068,7 +2068,7 @@ def savefig(self, fname, *, transparent=None, **kwargs):
20682068
transparent=False, bbox_inches=None, pad_inches=0.1,
20692069
frameon=None, metadata=None)
20702070
2071-
The output formats available depend on the backend being used.
2071+
The available output formats depend on the backend being used.
20722072
20732073
Parameters
20742074
----------
@@ -2086,27 +2086,28 @@ def savefig(self, fname, *, transparent=None, **kwargs):
20862086
20872087
Other Parameters
20882088
----------------
2089-
dpi : [ *None* | scalar > 0 | 'figure' ]
2090-
The resolution in dots per inch. If *None*, defaults to
2091-
:rc:`savefig.dpi`. If 'figure', uses the figure's dpi value.
2089+
dpi : float or 'figure', default: :rc:`savefig.dpi`
2090+
The resolution in dots per inch. If 'figure', use the figure's
2091+
dpi value.
2092+
2093+
quality : int, default: :rc:`savefig.jpeg_quality`
2094+
Applicable only if *format* is 'jpg' or 'jpeg', ignored otherwise.
20922095
2093-
quality : [ *None* | 1 <= scalar <= 100 ]
20942096
The image quality, on a scale from 1 (worst) to 95 (best).
2095-
Applicable only if *format* is jpg or jpeg, ignored otherwise.
2096-
If *None*, defaults to :rc:`savefig.jpeg_quality`.
2097-
Values above 95 should be avoided; 100 completely disables the
2098-
JPEG quantization stage.
2099-
2100-
optimize : bool
2101-
If *True*, indicates that the JPEG encoder should make an extra
2102-
pass over the image in order to select optimal encoder settings.
2103-
Applicable only if *format* is jpg or jpeg, ignored otherwise.
2104-
Is *False* by default.
2105-
2106-
progressive : bool
2107-
If *True*, indicates that this image should be stored as a
2108-
progressive JPEG file. Applicable only if *format* is jpg or
2109-
jpeg, ignored otherwise. Is *False* by default.
2097+
Values above 95 should be avoided; 100 disables portions of
2098+
the JPEG compression algorithm, and results in large files
2099+
with hardly any gain in image quality.
2100+
2101+
optimize : bool, default: False
2102+
Applicable only if *format* is 'jpg' or 'jpeg', ignored otherwise.
2103+
2104+
Whether the encoder should make an extra pass over the image
2105+
in order to select optimal encoder settings.
2106+
2107+
progressive : bool, default: False
2108+
Applicable only if *format* is 'jpg' or 'jpeg', ignored otherwise.
2109+
2110+
Whether the image should be stored as a progressive JPEG file.
21102111
21112112
facecolor : color or None, optional
21122113
The facecolor of the figure; if *None*, defaults to
@@ -2331,11 +2332,9 @@ def waitforbuttonpress(self, timeout=-1):
23312332
"""
23322333
Blocking call to interact with the figure.
23332334
2334-
This will return True is a key was pressed, False if a mouse
2335-
button was pressed and None if *timeout* was reached without
2336-
either being pressed.
2337-
2338-
If *timeout* is negative, does not timeout.
2335+
Wait for user input and return True if a key was pressed, False if a
2336+
mouse button was pressed and None if no input was given within
2337+
*timeout* seconds. Negative values deactivate *timeout*.
23392338
"""
23402339
blocking_input = BlockingKeyMouseInput(self)
23412340
return blocking_input(timeout=timeout)
@@ -2450,7 +2449,7 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None,
24502449
24512450
To exclude an artist on the axes from the bounding box calculation
24522451
that determines the subplot parameters (i.e. legend, or annotation),
2453-
then set `a.set_in_layout(False)` for that artist.
2452+
set `a.set_in_layout(False)` for that artist.
24542453
24552454
Parameters
24562455
----------

lib/matplotlib/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def axes(arg=None, **kwargs):
732732
a custom projection, see `~matplotlib.projections`. The default
733733
None results in a 'rectilinear' projection.
734734
735-
polar : boolean, optional
735+
polar : bool, default: False
736736
If True, equivalent to projection='polar'.
737737
738738
sharex, sharey : `~.axes.Axes`, optional
@@ -857,7 +857,7 @@ def subplot(*args, **kwargs):
857857
of a custom projection, see `~matplotlib.projections`. The default
858858
None results in a 'rectilinear' projection.
859859
860-
polar : boolean, optional
860+
polar : bool, default: False
861861
If True, equivalent to projection='polar'.
862862
863863
sharex, sharey : `~.axes.Axes`, optional

0 commit comments

Comments
 (0)