- Notifications
You must be signed in to change notification settings - Fork 908
/
Copy pathtip-transparency.py
30 lines (24 loc) · 872 Bytes
/
tip-transparency.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
28
29
30
# -----------------------------------------------------------------------------
# Matplotlib cheat sheet
# Released under the BSD License
# -----------------------------------------------------------------------------
importpathlib
importnumpyasnp
importmatplotlibasmpl
importmatplotlib.pyplotasplt
ROOT_DIR=pathlib.Path(__file__).parent.parent
mpl.rc('axes', linewidth=1.5)
np.random.seed(123)
fig=plt.figure(figsize=(2, 2), dpi=100)
margin=0.01
ax=fig.add_axes([margin, margin, 1-2*margin, 1-2*margin])
n=500
X=np.random.normal(0, 0.25, n)
Y=np.random.normal(0, 0.25, n)
ax.scatter(X, Y, s=50, c="k", lw=2)
ax.scatter(X, Y, s=50, c="w", lw=0)
ax.scatter(X, Y, s=40, c="C1", lw=0, alpha=0.1)
ax.set_xlim([-1, 1]), ax.set_xticks([]),
ax.set_ylim([-1, 1]), ax.set_yticks([])
fig.savefig(ROOT_DIR/"figures/tip-transparency.pdf")
# plt.show()