forked from matplotlib/cheatsheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathannotate.py
27 lines (20 loc) · 915 Bytes
/
annotate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -----------------------------------------------------------------------------
# Matplotlib cheat sheet
# Released under the BSD License
# -----------------------------------------------------------------------------
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(6, 1))
# ax = plt.subplot(111, frameon=False, aspect=.1)
# b = 0.0
ax = fig.add_axes([0, 0, 1, 1], frameon=False, aspect=1)
plt.scatter([5.5], [0.75], s=100, c="k")
plt.xlim(0, 6), plt.ylim(0, 1)
plt.xticks([]), plt.yticks([])
plt.annotate("text", (5.5, .75), (0.75, .75), size=16, va="center", ha="center",
arrowprops=dict(facecolor='black', shrink=0.05))
plt.text( 5.5, 0.6, "xy\nxycoords", size=10, va="top", ha="center", color=".5")
plt.text( .75, 0.6, "xytext\ntextcoords", size=10, va="top", ha="center", color=".5")
plt.savefig("../figures/annotate.pdf")
# plt.show()