Matplotlib 3.0 Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

  • np.linspace(-3, 3, 100) creates 100 data points in the range of -3 to 3 with equal gaps between consecutive points. x and y are randomly generated vectors of length 100 and 50 with ranges -3 to 3 and -2 to 4, respectively.
  • np.meshgrid(x, y) creates the mesh grid as explained earlier in the chapter.
  • U and V are velocity vectors as a function of x and y. A stream plot is a combination of vectors x, y and velocities U and Vplt.streamplot(X, Y, U, V) plots the stream plot and it looks as shown here: