首页 > 解决方案 > Matplotlib.pyplot:如何增加 streamplot 产生的流线的长度?

问题描述

运行此 python 代码:

import matplotlib.pyplot as plt
import numpy as np

nx = 128
x_min = -2
x_max = 2
x = np.linspace(x_min, x_max, nx)

ny = 128
y_min = -2
y_max = 2
y = np.linspace(y_min, y_max, ny)

X, Y = np.meshgrid(x, y)

U = -Y
V = X

fig = plt.figure()
ax = fig.add_subplot(111)
ax.streamplot(X, Y, U, V, density = 0.5)
ax.set_xlim(x_min, x_max)
ax.set_ylim(y_min, y_max)
ax.set_aspect('equal')
plt.savefig('circle_streamlines.png')

生成下图: 蒸汽线 如何增加流线的长度以使它们形成完整的圆?

标签: pythonnumpymatplotlib

解决方案


推荐阅读