Skip to content

Instantly share code, notes, and snippets.

Last active May 30, 2020
What would you like to do?
# plot data
# add two layers of points to create an illusion of a discontinuous line. "zorder" specifies plotting order
ax.scatter(x, y, s=64, color='white', zorder=2)
ax.scatter(x, y, s=8, color='black', zorder=3)
# add connecting line
ax.plot(x, y, color='black', zorder=1, linewidth=0.7)
# add horizontal dotted lines. See linestyles here:
ax.plot([1970, 1977], [380, 380], linestyle=(
0, (5, 10)), linewidth=0.3, color='black')
ax.plot([1970, 1977], [400, 400], linestyle=(
0, (5, 10)), linewidth=0.3, color='black')
# add text
ax.text(1967, 415, "Per capita\nbudget expenditures,\nin constant dollars")
ax.text(1978, 390, "5%")
# add bar
bar = ArrowStyle.BarAB(widthA=0.2, widthB=0.2)
ax.annotate('', xy=(1977.5, 378), xytext=(1977.5, 402),
arrowprops={'arrowstyle': bar, 'lw': 0.7})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment