How to do it...

The following code block creates a stream plot:

  1. Prepare the data for the stream plot:
x, y = np.linspace(-3,3,100), np.linspace(-2,4,50)
  1. Create the mesh grid:
X, Y = np.meshgrid(x, y)
  1. Compute velocities, U and V, as a function of X and Y respectively:
U = 1 - X**2 
V = 1 + Y**2
  1. Plot the stream plot:
plt.streamplot(X, Y, U, V)
  1. Set the title for the plot:
plt.title('Basic Streamplot')
  1. Display the graph on the screen:
plt.show()