fig, ax = plt.subplots(figsize=(7, 7))
ax.set_facecolor("#ADBBFE")
psi_levels = [-10, -7.5, -5, 0, 5, 10, 20, 30, 40, 50, 60, 70]
contours = ax.contour(
X, Y, psi,
levels=psi_levels,
colors="black",
linewidths=1.6
)
ax.clabel(
contours,
inline=True,
fontsize=13,
fmt=r'$\psi=%g$'
)
# Add one arrow along each streamline
for level_segs in contours.allsegs:
for seg in level_segs:
verts = seg
if len(verts) < 2: continue
i = len(verts) // 2
x0, y0 = verts[i]
x1, y1 = verts[i+1]
ax.annotate(
'', xy=(x1, y1), xytext=(x0, y0),
arrowprops=dict(
arrowstyle='->',
color='black',
lw=1.8
)
)
vector_points = [(3.0, 4.0), (1.5, -0.5), (2.0, 0.0), (2.5, 1.0)]
for x0, y0 in vector_points:
u0 = b
v0 = -3*a*x0**2 - c
ax.quiver(x0, y0, u0, v0, angles='xy', scale_units='xy', scale=10, width=0.006, color="#aee2ff")