How define a boundary in matplotlib python?
问题 I want to plot the following field equations: dx/dt = x*(4*y+3*x-3) dy/dt = y*(4*y+3*x-4) but I do not know how can I restrict the boundary to a triangle: x>=0, y>=0, x<=1-y : # stream plot with matplotlib import numpy as np import matplotlib.pyplot as plt def velocity_i(x,y): vx = x*(3*x+4*y-3) vy = y*(3*x+4*y-4) return vx, vy n=100 x = np.linspace(0, 1, n) y = np.linspace(0, 1, n) X, Y = np.meshgrid(x, y) Ux, Uy = velocity_i(X, Y) vels = (Ux**2+Uy**2)**0.5 plt.figure(figsize=(5,4)) stream =