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

Skip to content

Commit ecba5e3

Browse files
committed
added a text example
svn path=/trunk/matplotlib/; revision=5457
1 parent c198c6e commit ecba5e3

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

doc/users/figures/text_commands.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
import matplotlib.pyplot as plt
3+
4+
fig = plt.figure()
5+
fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold')
6+
7+
ax = fig.add_subplot(111)
8+
9+
ax.set_title('axes title')
10+
11+
ax.set_xlabel('xlabel')
12+
ax.set_ylabel('ylabel')
13+
ax.text(5, 8, 'italics text in data coords', style='italic')
14+
ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=20)
15+
16+
ax.text(0.95, 0.01, 'text in axes coords',
17+
verticalalignment='bottom', horizontalalignment='right',
18+
transform=ax.transAxes,
19+
color='green', fontsize=20)
20+
21+
22+
ax.plot([2], [1], 'o')
23+
ax.annotate('annotate', xy=(2, 1), xytext=(3, 4),
24+
arrowprops=dict(facecolor='black', shrink=0.05))
25+
26+
ax.axis([0, 10, 0, 10])
27+
28+
plt.show()

0 commit comments

Comments
 (0)