#### Overview of this book

In this book, you’ll get hands-on with customizing your data plots with the help of Matplotlib. You’ll start with customizing plots, making a handful of special-purpose plots, and building 3D plots. You’ll explore non-trivial layouts, Pylab customization, and more about tile configuration. You’ll be able to add text, put lines in plots, and also handle polygons, shapes, and annotations. Non-Cartesian and vector plots are exciting to construct, and you’ll explore them further in this book. You’ll delve into niche plots and visualize ordinal and tabular data. In this book, you’ll be exploring 3D plotting, one of the best features when it comes to 3D data visualization, along with Jupyter Notebook, widgets, and creating movies for enhanced data representation. Geospatial plotting will also be explored. Finally, you’ll learn how to create interactive plots with the help of Jupyter. Learn expert techniques for effective data visualization using Matplotlib 3 and Python with our latest offering -- Matplotlib 3.0 Cookbook
Preface
Free Chapter
Heavy Customization
Drawing on Plots
Special Purpose Plots
3D and Geospatial Plots
Interactive Plotting
Other Books You May Enjoy

# Plotting vector fields

First, though, we will generate a standard Gaussian random field so that we have a nice gradient:

# Generate a vector field with a gradientfrom scipy.ndimage.filters import gaussian_filterx = np.arange(0,10,0.5)y = np.arange(0,10,0.5)phi = gaussian_filter(np.random.uniform(size=(20,20)), sigma=5)plt.subplot(141)plt.imshow(phi, interpolation='none')plt.title(r'$\Phi$')plt.subplot(142)plt.imshow(np.gradient(phi)[0], interpolation='none')plt.title(r'$\partial_x\Phi$')plt.subplot(143)plt.title(r'$\partial_y\Phi$')plt.imshow(np.gradient(phi)[1], interpolation='none')plt.subplot(144)plt.title(r'$\|\nabla \Phi\|$')plt.imshow(np.linalg.norm(np.gradient(phi), axis=0), interpolation='none')plt.gcf().set_size_inches(8,4)

Following is the output of the preceding code:

Let's take look...