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

Skip to content

Commit e22b3a6

Browse files
committed
Improve documentation of FontManager
1 parent de6c955 commit e22b3a6

File tree

1 file changed

+36
-20
lines changed

1 file changed

+36
-20
lines changed

lib/matplotlib/font_manager.py

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -627,32 +627,33 @@ class FontProperties:
627627
628628
- family: A list of font names in decreasing order of priority.
629629
The items may include a generic font family name, either
630-
'sans-serif' (default), 'serif', 'cursive', 'fantasy', or 'monospace'.
630+
'sans-serif', 'serif', 'cursive', 'fantasy', or 'monospace'.
631631
In that case, the actual font to be used will be looked up
632-
from the associated rcParam.
632+
from the associated rcParam. Default: :rc:`font.family`
633633
634-
- style: Either 'normal' (default), 'italic' or 'oblique'.
634+
- style: Either 'normal', 'italic' or 'oblique'.
635+
Default: :rc:`font.style`
635636
636-
- variant: Either 'normal' (default) or 'small-caps'.
637+
- variant: Either 'normal' or 'small-caps'.
638+
Default: :rc:`font.variant`
637639
638640
- stretch: A numeric value in the range 0-1000 or one of
639641
'ultra-condensed', 'extra-condensed', 'condensed',
640-
'semi-condensed', 'normal' (default), 'semi-expanded', 'expanded',
641-
'extra-expanded' or 'ultra-expanded'.
642+
'semi-condensed', 'normal', 'semi-expanded', 'expanded',
643+
'extra-expanded' or 'ultra-expanded'. Default: :rc:`font.stretch`
642644
643645
- weight: A numeric value in the range 0-1000 or one of
644-
'ultralight', 'light', 'normal' (default), 'regular', 'book', 'medium',
646+
'ultralight', 'light', 'normal', 'regular', 'book', 'medium',
645647
'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy',
646-
'extra bold', 'black'.
648+
'extra bold', 'black'. Default: :rc:`font.weight`
647649
648650
- size: Either an relative value of 'xx-small', 'x-small',
649651
'small', 'medium', 'large', 'x-large', 'xx-large' or an
650-
absolute font size, e.g., 10 (default).
652+
absolute font size, e.g., 10. Default: :rc:`font.size`
651653
652-
- math_fontfamily: The family of fonts used to render math text; overrides
653-
:rc:`mathtext.fontset`. Supported values are the same as the ones
654-
supported by :rc:`mathtext.fontset`: 'dejavusans', 'dejavuserif', 'cm',
655-
'stix', 'stixsans' and 'custom'.
654+
- math_fontfamily: The family of fonts used to render math text.
655+
Supported values are: 'dejavusans', 'dejavuserif', 'cm',
656+
'stix', 'stixsans' and 'custom'. Default: :rc:`mathtext.fontset`
656657
657658
Alternatively, a font may be specified using the absolute path to a font
658659
file, by using the *fname* kwarg. However, in this case, it is typically
@@ -807,7 +808,7 @@ def set_family(self, family):
807808
is CSS parlance), such as: 'serif', 'sans-serif', 'cursive',
808809
'fantasy', or 'monospace', a real font name or a list of real
809810
font names. Real font names are not supported when
810-
:rc:`text.usetex` is `True`.
811+
:rc:`text.usetex` is `True`. Default: :rc:`font.family`
811812
"""
812813
if family is None:
813814
family = rcParams['font.family']
@@ -817,7 +818,11 @@ def set_family(self, family):
817818

818819
def set_style(self, style):
819820
"""
820-
Set the font style. Values are: 'normal', 'italic' or 'oblique'.
821+
Set the font style.
822+
823+
Parameters
824+
----------
825+
style : {'normal', 'italic', 'oblique'}, default: :rc:`font.style`
821826
"""
822827
if style is None:
823828
style = rcParams['font.style']
@@ -826,7 +831,11 @@ def set_style(self, style):
826831

827832
def set_variant(self, variant):
828833
"""
829-
Set the font variant. Values are: 'normal' or 'small-caps'.
834+
Set the font variant.
835+
836+
Parameters
837+
----------
838+
variant : {'normal', 'small-caps'}, default: :rc:`font.variant`
830839
"""
831840
if variant is None:
832841
variant = rcParams['font.variant']
@@ -838,7 +847,8 @@ def set_weight(self, weight):
838847
Set the font weight. May be either a numeric value in the
839848
range 0-1000 or one of 'ultralight', 'light', 'normal',
840849
'regular', 'book', 'medium', 'roman', 'semibold', 'demibold',
841-
'demi', 'bold', 'heavy', 'extra bold', 'black'
850+
'demi', 'bold', 'heavy', 'extra bold', 'black'.
851+
Default: :rc:`font.weight`
842852
"""
843853
if weight is None:
844854
weight = rcParams['font.weight']
@@ -857,6 +867,7 @@ def set_stretch(self, stretch):
857867
'extra-condensed', 'condensed', 'semi-condensed', 'normal',
858868
'semi-expanded', 'expanded', 'extra-expanded' or
859869
'ultra-expanded', or a numeric value in the range 0-1000.
870+
Default: :rc:`font.stretch`
860871
"""
861872
if stretch is None:
862873
stretch = rcParams['font.stretch']
@@ -871,9 +882,14 @@ def set_stretch(self, stretch):
871882

872883
def set_size(self, size):
873884
"""
874-
Set the font size. Either an relative value of 'xx-small',
875-
'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'
876-
or an absolute font size, e.g., 12.
885+
Set the font size.
886+
887+
Parameters
888+
----------
889+
size : float or {'xx-small', 'x-small', 'small', 'medium', \
890+
'large', 'x-large', 'xx-large'}, default: :rc:`font.size`
891+
If float, the font size in points. The string values denote sizes
892+
relative to the default font size.
877893
"""
878894
if size is None:
879895
size = rcParams['font.size']

0 commit comments

Comments
 (0)