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

Skip to content

Commit cc18501

Browse files
committed
Cleanup and move text themes demo
1 parent e4dce4e commit cc18501

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

examples/pylab_examples/text_themes.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

examples/tests/backend_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
]
7979

8080
files['text_labels_and_annotations'] = [
81+
'text_demo_fontdict.py',
8182
'unicode_demo.py',
8283
]
8384

@@ -239,7 +240,6 @@
239240
'text_handles.py',
240241
'text_rotation.py',
241242
'text_rotation_relative_to_line.py',
242-
'text_themes.py',
243243
'transoffset.py',
244244
'vline_demo.py',
245245
'xcorr_demo.py',
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Demo using fontdict to control style of text and labels.
3+
"""
4+
import numpy as np
5+
import matplotlib.pyplot as plt
6+
7+
8+
font = {'family' : 'serif',
9+
'color' : 'darkred',
10+
'weight' : 'normal',
11+
'size' : 16,
12+
}
13+
14+
x = np.linspace(0.0, 5.0, 100)
15+
y = np.cos(2 * np.pi * x) * np.exp(-x)
16+
17+
plt.plot(x, y, 'k')
18+
plt.title('Damped exponential decay', fontdict=font)
19+
plt.text(2, 0.65, r'$\cos(2 \pi t) \exp(-t)$', fontdict=font)
20+
plt.xlabel('time (s)', fontdict=font)
21+
plt.ylabel('voltage (mV)', fontdict=font)
22+
23+
plt.show()

0 commit comments

Comments
 (0)