# How to | Plot a Vector Field

You can visualize a vector field by plotting vectors on a regular grid, by plotting a selection of streamlines, or by using a gradient color scheme to illustrate vector and streamline densities. You can also plot a vector field from a list of vectors as opposed to a mapping.

Use VectorPlot to plot vectors in a vector field given by a mapping from to :

Out[1]= | |

Use StreamPlot to plot streamlines:

Out[2]= | |

Use the StreamPoints option to plot selected streamlines:

Out[3]= | |

Use the StreamPoints option to select streamlines in the plot:

Out[4]= | |

Use VectorDensityPlot and StreamDensityPlot to visualize the field densities:

Out[5]= | |

Out[6]= | |

Use VectorPlot3D to plot a three-dimensional vector field (vectors are colored depending on their magnitude):

Out[7]= | |

In addition to simply plotting vector fields, *Mathematica* allows you to fine-tune these plots. These examples illustrate some of the options that can be applied.

Use VectorStyle to change the type of arrows in VectorPlot:

Out[8]= | |

Use StreamPoints to control the number of streamlines in the plot:

Out[9]= | |

Combine vectors and streamlines into a single plot:

Out[10]= | |

Use ColorFunction to apply a color scheme based on the density of vectors and streamlines:

Out[11]= | |

You can use VectorColorFunction to choose a color scheme and specify a function with which to color the vectors. This makes two plots colored with the "DarkRainbow" color scheme, each according to the functions specified in VectorColorFunction:

Out[12]= | |

Because some functions used in VectorColorFunction are common, *Mathematica* allows you to call them as variables. These are represented by integers ranging from 1 to 5, where 1 is the variable, 2 is the variable, 3 is the first field component, 4 is the second field component, and 5 is the vector magnitude. To specify these variables, use with VectorColorFunction, where represents the variable number.

Color the plot according to the second field component (), with the "DarkRainbow" color scheme:

Out[13]= | |

Color the plot according to the vector magnitude (), also with the "DarkRainbow" color scheme:

Out[14]= | |

Plot streamlines from a specified point, in one direction:

Out[15]= | |

Use VectorStyle to get 3D effects in VectorPlot3D:

Out[16]= | |