-
Notifications
You must be signed in to change notification settings - Fork 922
Expand file tree
/
Copy pathtip-outline.py
More file actions
27 lines (22 loc) · 984 Bytes
/
tip-outline.py
File metadata and controls
27 lines (22 loc) · 984 Bytes
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
# -----------------------------------------------------------------------------
# Scripts to generate all the basic plots
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
fig = plt.figure(figsize=(2, 2))
mpl.rcParams['axes.linewidth'] = 1.5
d = 0.01
ax = fig.add_axes([d, d, 1-2*d, 1-2*d], xticks=[], yticks=[])
np.random.seed(1)
Z = np.random.uniform(0, 1, (8, 8))
cmap = plt.get_cmap("Oranges")
ax.imshow(Z, interpolation="nearest", cmap=cmap, vmin=0, vmax=2)
text = ax.text(0.5, 0.1, "Label", transform=ax.transAxes,
color=cmap(0.9), size=32, weight="bold", ha="center", va="bottom")
text.set_path_effects([path_effects.Stroke(linewidth=5, foreground='white'),
path_effects.Normal()])
plt.savefig("../figures/tip-outline.pdf")