Skip to content

Commit 14c2de8

Browse files
authored
print defaults
1 parent c71571b commit 14c2de8

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

examples/text_labels_and_annotations/font_family_rc.py

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@
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

3340
import 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

5257
plt.rcParams["font.family"] = "sans-serif"
5358
plt.rcParams["font.sans-serif"] = ["Nimbus Sans"]
5459
print_text("Hello World! 02")
5560

5661

5762
##################################################################
58-
#
5963
# Chooses default monospace font
60-
# ------------------------------
6164

6265
plt.rcParams["font.family"] = "monospace"
6366
print_text("Hello World! 04")
6467

6568

66-
##################################################################
67-
#
69+
###################################################################
6870
# Chose monospace font and specify to it to "FreeMono"
69-
# ----------------------------------------------------
71+
7072
plt.rcParams["font.family"] = "monospace"
7173
plt.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

Comments
 (0)