2626
2727.. redirect-from:: /examples/font_family_rc_sgskip
2828
29- First example, chooses default sans-serif font:
29+ ###### First example, chooses default sans-serif font:
3030"""
3131
3232import matplotlib .pyplot as plt
@@ -45,7 +45,7 @@ def print_text(text):
4545
4646#################################################################
4747#
48- # Second example:
48+ ###### Second example:
4949
5050plt .rcParams ["font.family" ] = "sans-serif"
5151plt .rcParams ["font.sans-serif" ] = ["Nimbus Sans" ]
@@ -54,22 +54,22 @@ def print_text(text):
5454
5555#################################################################
5656#
57- # Third example:
57+ ###### Third example:
5858
5959plt .rcParams ["font.family" ] = "sans-serif"
6060plt .rcParams ["font.sans-serif" ] = ["Humor Sans" ]
6161print_text ("Hello World! 03" )
6262
6363
6464##################################################################
65- # Fourth example, chooses default monospace font:
65+ ###### Fourth example, chooses default monospace font:
6666
6767plt .rcParams ["font.family" ] = "monospace"
6868print_text ("Hello World! 04" )
6969
7070
7171##################################################################
72- # Fifth example:
72+ ###### Fifth example:
7373
7474plt .rcParams ["font.family" ] = "monospace"
7575plt .rcParams ["font.monospace" ] = ["FreeMono" ]
@@ -79,21 +79,9 @@ def print_text(text):
7979
8080#############################################################################
8181#
82- # Print all available font paths (this is OS specific):
82+ ###### Print all available font paths (this is OS specific):
8383
8484import matplotlib .font_manager
8585fpaths = matplotlib .font_manager .findSystemFonts (fontpaths = None , fontext = 'ttf' )
8686for i in fpaths :
8787 print (i )
88-
89-
90- #############################################################################
91- #
92- # Print all available font names and their style (this is OS specific):
93-
94- import matplotlib .font_manager
95- fpaths = matplotlib .font_manager .findSystemFonts ()
96-
97- for i in fpaths :
98- f = matplotlib .font_manager .get_font (i )
99- print (f"{ f .family_name = :<35} { f .style_name = } " )
0 commit comments