|MATLAB Function Reference|
Plot velocity vectors as cones in a 3-D vector field
coneplot(X,Y,Z,U,V,W,Cx,Cy,Cz) plots velocity vectors as cones pointing in the direction of the velocity vector and having a length proportional to the magnitude of the velocity vector.
Zdefine the coordinates for the vector field
Wdefine the vector field. These arrays must be the same size, monotonic, and 3-D plaid (such as the data produced by
Czdefine the location of the cones in vector field. The section Starting Points for Stream Plots in Visualization Techniques provides more information on defining starting points.
coneplot(U,V,W,Cx,Cy,Cz) (omitting the
Z arguments) assumes
[X,Y,Z] = meshgrid(1:n,1:m,1:p) where
coneplot(...,s) MATLAB automatically scales the cones to fit the graph and then stretches them by the scale factor
s. If you do not specify a value for s, MATLAB uses a value of 1. Use s
0 to plot the cones without automatic scaling.
interpolates the array
color onto the vector field and then colors the cones according to the interpolated values. The size of the
color array must be the same size as the
W arrays. This option works only with cones (i.e., not with the
coneplot(...,'quiver') draws arrows instead of cones (see
quiver3 for an illustration of a quiver plot).
) specifies the interpolation method to use.
method can be:
linear is the default (see
interp3 for a discussion of these interpolation methods)
does not interpolate the positions of the cones into the volume. The cones are drawn at positions defined by
Z and are oriented according to
W must all be the same size.
h = coneplot(...) returns the handle to the
patch object used to draw the cones. You can use the
set command to change the properties of the cones.
coneplot automatically scales the cones to fit the graph, while keeping them in proportion to the respective velocity vectors.
It is usually best to set the data aspect ratio of the axes before calling
coneplot. You can set the ratio using the
This example plots the velocity vector cones for vector volume data representing the motion of air through a rectangular region of space. The final graph employs a number of enhancements to visualize the data more effectively. These include:
1. Load and Inspect Data
The winds data set contains six 3-D arrays:
w specify the vector components at each of the coordinate specified in
z. The coordinates define a lattice grid structure where the data is sampled within the volume.
It is useful to establish the range of the data to place the slice planes and to specify where you want the cone plots (
2. Create the Cone Plot
daspectto set the data aspect ratio of the axes before calling
coneplotso MATLAB can determine the proper size of the cones.
3. Add the Slice Planes
xmax, along the y-axis at
ymax, and along the z-axis at
4. Define the View
axiscommand to set the axis limits equal to the range of the data.
viewto azimuth = 30 and elevation = 40 (
rotate3dis a useful command for selecting the best view).
5. Add Lighting to the Scene
The light source affects both the slice planes (surfaces) and the cone plots (patches). However, you can set the lighting characteristics of each independently.
AmbientStrengthproperty for each slice plane to improve the visibility of the dark blue colors. (Note that you can also specify a different
colormapto change to coloring of the slice planes.)
DiffuseStrengthproperty of the cones to brighten particularly those cones not showing specular reflections.
Volume Visualization for related functions