Vector field (2D)
A vector field is an element that displays a number of vectors in a uniform grid of the plane. The vectors size can be specified directly, or using a constant length and varying direction. Each vector in the field can be given a color code according to a magnitude.
Using color rather than arrow length to represent a vector field’s strength produces a more effective representation of magnitude over a wider range of values. The color palette is set using the Color Mode property in the Graphics Aspect section of the inspector. The default palette changes the arrow color from the Min Color (default is blue) toward Max Color (default is red) as the magnitude increases. Use the inspector to change the color mode to GRAYSCALE and run the model to see how this palette assigns the colors.
The appearance section of the inspector allows us to further control the mapping of field strength to color. The Color Mode selects a color pallet and the default Appearance properties set the first color to minimum magnitude vectors and the last color to maximum magnitude arrows. We can, however, assign our our own map. For example, setting the Color Component property to 1 uses the color that correspond to 1 for all arrows. All vectors will be displayed in red because the default maximum value is 1 and red is the last color in the default palette. Set the Color Component to 0 and the first color (blue) in the default palette is used. To control the color of every grid point, the Color Component property accepts a double[][] array that maps each double value to an arrow color at the corresponding grid point.
Properties
SimpleVectorField2D  |
Position and Size |
Name | Description | Values accepted | Default |
Minimum X | The minimum X value that can be displayed. | A constant or variable of type int or double. | |
Maximum X | The maximum X value that can be displayed. | A constant or variable of type int or double. | |
Minimum Y | The minimum Y value that can be displayed. | A constant or variable of type int or double. | |
Maximum Y | The maximum Y value that can be displayed. | A constant or variable of type int or double. | |
Centered | Whether to center the elements. | A boolean variable or one of the constants true or false. | |
X Component | The double value or double[][] array of the X component of the vector field. | A variable of type integer, double or double[]. | |
Y Component | The double value or double[][] array of the Y component of the vector field. | A variable of type integer, double or double[]. | |
Length | The double value for the length of all the arrows or segments in the field. | A constant or variable of type int or double. | |
Angles | The double valuer or double[][]array of direction angles (in radians) for the elements. | A variable of type integer, double or double[]. | |
Graphical Aspect |
Name | Description | Values accepted | Default |
Visible | The visibility of the element. | A boolean variable or one of the constants true or false. | |
Style | The drawing style for the element. | Use the editor provided to make a choice. | |
Stroke | The thickness and line style for the lines of the element. | A constant or variable of type double or int or an Object. | |
Min Color | The minimum color of the arrows. | Use the editor provided or read about colors. | |
Max Color | The maximum color of the arrows. | Use the editor provided or read about colors. | |
Appearance |
Name | Description | Values accepted | Default |
Color Component | The double value or double[][] array of color components for the color of the field. | A variable of type integer, double or double[]. | |
Autoscale | Whether to automatically adjust the colors to the data. | A boolean variable or one of the constants true or false. | |
Minimum | The minimum value that can be displayed. | A constant or variable of type int or double. | |
Maximum | The miaximum value that can be displayed. | A constant or variable of type int or double. | |
Levels | The number of levels to differentiate. | An integer value. | |
Invis Level | A level below which (inclusive) arrows are not shown. | An integer value. | |