2626
2727.. redirect-from:: /examples/font_family_rc_sgskip
2828
29- Chooses default sans-serif font
30- -------------------------------
29+
30+
31+ The font font.family defaults are OS dependent and can be viewed with
3132"""
33+ print (plt .rcParams ["font.sans-serif" ][0 ])
34+ print (plt .rcParams ["font.monospace" ][0 ])
35+
36+
37+ #################################################################
38+ # Chooses default sans-serif font
3239
3340import matplotlib .pyplot as plt
3441
@@ -45,39 +52,23 @@ def print_text(text):
4552
4653
4754#################################################################
48- #
4955# Chose sans-serif font and specify to it to "Nimbus Sans"
50- # --------------------------------------------------------
5156
5257plt .rcParams ["font.family" ] = "sans-serif"
5358plt .rcParams ["font.sans-serif" ] = ["Nimbus Sans" ]
5459print_text ("Hello World! 02" )
5560
5661
5762##################################################################
58- #
5963# Chooses default monospace font
60- # ------------------------------
6164
6265plt .rcParams ["font.family" ] = "monospace"
6366print_text ("Hello World! 04" )
6467
6568
66- ##################################################################
67- #
69+ ###################################################################
6870# Chose monospace font and specify to it to "FreeMono"
69- # ----------------------------------------------------
71+
7072plt .rcParams ["font.family" ] = "monospace"
7173plt .rcParams ["font.monospace" ] = ["FreeMono" ]
72- print_text ("Hello World! 05" )
73-
74-
75- ##################################################################
76- #
77- # Print all available font paths (this is OS specific)
78- # ----------------------------------------------------
79-
80- import matplotlib .font_manager
81- fpaths = matplotlib .font_manager .findSystemFonts (fontpaths = None , fontext = 'ttf' )
82- for i in fpaths :
83- print (i )
74+ print_text ("Hello World! 05" )
0 commit comments