Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: matplotlib/cheatsheets
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8b63fb3f17257e2f83702f6770684d63f82383cc
Choose a base ref
..
head repository: matplotlib/cheatsheets
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 44f015cba20f69fa78d5ebbf1da080ae4905f889
Choose a head ref
Showing with 13 additions and 11 deletions.
  1. +9 −9 scripts/adjustements.py
  2. +4 −2 scripts/advanced-plots.py
18 changes: 9 additions & 9 deletions scripts/adjustements.py
Original file line number Diff line number Diff line change
@@ -48,38 +48,38 @@

# Window size extension
X, Y = [0, 0], [0, -8]
plt.plot(X, Y, color="black", linestyle=":", linewidth=1, clip_on=False)
plt.plot(X, Y, color="gray", zorder=0, linewidth=1, clip_on=False)

X, Y = [100, 100], [0, -8]
plt.plot(X, Y, color="black", linestyle=":", linewidth=1, clip_on=False)
plt.plot(X, Y, color="gray", zorder=0, linewidth=1, clip_on=False)

X, Y = [100, 108], [0, 0]
plt.plot(X, Y, color="black", linestyle=":", linewidth=1, clip_on=False)
plt.plot(X, Y, color="gray", zorder=0, linewidth=1, clip_on=False)

X, Y = [100, 108], [75, 75]
plt.plot(X, Y, color="black", linestyle=":", linewidth=1, clip_on=False)
plt.plot(X, Y, color="gray", zorder=0, linewidth=1, clip_on=False)


def ext_arrow(p0, p1, p2, p3):
p0, p1 = np.asarray(p0), np.asarray(p1)
p2, p3 = np.asarray(p2), np.asarray(p3)
ax.arrow(*p0, *(p1-p0), zorder=20, linewidth=0,
length_includes_head=True, width=.4,
head_width=2, head_length=2, color="black")
head_width=2, head_length=2, color="gray")
ax.arrow(*p3, *(p2-p3), zorder=20, linewidth=0,
length_includes_head=True, width=.4,
head_width=2, head_length=2, color="black")
plt.plot([p1[0], p2[0]], [p1[1], p2[1]], linewidth=.9, color="black")
head_width=2, head_length=2, color="gray")
plt.plot([p1[0], p2[0]], [p1[1], p2[1]], zorder=20, linewidth=.9, color="gray")


def int_arrow(p0, p1):
p0, p1 = np.asarray(p0), np.asarray(p1)
ax.arrow(*((p0+p1)/2), *((p1-p0)/2), zorder=20, linewidth=0,
length_includes_head=True, width=.4,
head_width=2, head_length=2, color="black")
head_width=2, head_length=2, color="gray")
ax.arrow(*((p0+p1)/2), *(-(p1-p0)/2), zorder=20, linewidth=0,
length_includes_head=True, width=.4,
head_width=2, head_length=2, color="black")
head_width=2, head_length=2, color="gray")


x = 0
6 changes: 4 additions & 2 deletions scripts/advanced-plots.py
Original file line number Diff line number Diff line change
@@ -17,11 +17,13 @@

# Stairs plot
# -----------------------------------------------------------------------------
X = np.linspace(0, 10, 16)
Y = 2*np.sin(2*X+0.3)
X = np.linspace(0, 2*np.pi, 9)
Y = 2*np.sin(3*X)
Y[7:] = 0
ax.stairs(Y, color="C1", linewidth=0.75)
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
ax.set_ylim(-4, 4), ax.set_yticks(np.arange(-4, 4))
ax.set_axisbelow(True)
ax.grid(linewidth=0.125)
plt.savefig("../figures/advanced-stairs.pdf")
ax.clear()