'Understanding streamplot function
I am trying to plot some vector fields using the streamplot function and following some tutorial (I am new to python) I found something like this
import numpy as np
import matplotlib.pyplot as plt
n=5
x=np.linspace(-3,3,n)
y=np.linspace(-3,3,n)
X,Y=np.meshgrid(x,y)
# vector field
u=np.cos(X+Y)
v=np.sin(X-Y)
# plot
plt.streamplot(X, Y, u, v, density=2)
plt.show()
so far so good, but if I change the meshgrid using for example n=50, the plot is almost the same. So what is the purpose of the 2d arrays X and Y in the streamplot function?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
