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

Skip to content

Commit 761f3d6

Browse files
authored
new example for rcParams font
1 parent e142894 commit 761f3d6

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

examples/text_labels_and_annotations/font_family_rc_sgskip.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,21 @@
3030
plt.rcParams['font.family'] = 'sans-serif'
3131
plt.rcParams['font.sans-serif'] = ['Tahoma']
3232

33-
fig, ax = plt.subplots()
34-
ax.plot([1, 2, 3], label='test')
35-
36-
ax.legend()
33+
fig, ax = plt.subplots(figsize=(6, 1), facecolor="#eefade")
34+
ax.text(0.01, 0.2, "Hello World! 01", size = 40)
35+
ax.axis("off")
3736
plt.show()
37+
38+
39+
"""
40+
And here a second example:
41+
"""
42+
43+
plt.rcParams['font.family'] = 'monospace'
44+
# plt.rcParams['font.monospace'] = ['Computer Modern Typewriter'] # this line gives an error currently, therefore the
45+
# question: How can one access the fonts from https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/mpl-data/matplotlibrc#L273
46+
# the correct way?
47+
fig, ax = plt.subplots(figsize=(6, 1), facecolor="#eefade")
48+
ax.text(0.01, 0.2, "Hello World! 01", size = 40)
49+
ax.axis("off")
50+
plt.show()

0 commit comments

Comments
 (0)