的
linewidths参数来
plt.quiver控制的箭头的厚度。如果将其传递为一维值数组,则每个箭头将具有不同的粗细。
例如,
widths = np.linspace(0, 2, X.size)plt.quiver(X, Y, cos(deg), sin(deg), linewidths=widths)
创建从0到2的线宽。
import matplotlib.pyplot as pltimport numpy as npsin = np.sincos = np.cos# http://stackoverflow.com/questions/6370742/#6372413xmax = 4.0xmin = -xmaxD = 20ymax = 4.0ymin = -ymaxx = np.linspace(xmin, xmax, D)y = np.linspace(ymin, ymax, D)X, Y = np.meshgrid(x, y)# plots the vector field for Y'=Y**3-3*Y-Xdeg = np.arctan(Y ** 3 - 3 * Y - X)widths = np.linspace(0, 2, X.size)plt.quiver(X, Y, cos(deg), sin(deg), linewidths=widths)plt.show()
产量
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)