Plot velocity vectors as cones in 3-D vector field
h = coneplot(...)
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. X, Y, Z define the coordinates for the vector field. U, V, W define the vector field. These arrays must be the same size, monotonic, and represent a Cartesian, axis-aligned grid (such as the data produced by meshgrid). Cx, Cy, Cz define the location of the cones in the vector field. The section Specifying Starting Points for Stream Plots in Visualization Techniques provides more information on defining starting points.
coneplot(...,s) 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, coneplot uses a value of 1. Use s = 0 to plot the cones without automatic scaling.
coneplot(...,color) 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 U, V, W arrays. This option works only with cones (that is, not with the quiver option).
coneplot(...,'quiver') draws arrows instead of cones (see quiver3 for an illustration of a quiver plot).
coneplot(...,'method') specifies the interpolation method to use. method can be linear, cubic, or nearest. linear is the default. (See interp3 for a discussion of these interpolation methods.)
coneplot(X,Y,Z,U,V,W,'nointerp') does not interpolate the positions of the cones into the volume. The cones are drawn at positions defined by X, Y, Z and are oriented according to U, V, W. Arrays X, Y, Z, U, V, W must all be the same size.
coneplot(axes_handle,...) plots into the axes with the handle axes_handle instead of into the current axes (gca).
coneplot automatically scales the cones to fit the graph, while keeping them in proportion to the respective velocity vectors.
Plot the velocity vector cones for vector volume data representing the motion of air through a rectangular region of space:
Load the data. The winds data set contains six 3-D arrays: u, v, and w specify the vector components at each of the coordinates specified in x, y, and z. The coordinates define a lattice grid structure where the data is sampled within the volume. load wind.
xmin = min(x(:)); xmax = max(x(:)); ymin = min(y(:)); ymax = max(y(:)); zmin = min(z(:));
Use daspect to set the data aspect ratio of the axes before calling coneplot.
xrange = linspace(xmin,xmax,8); yrange = linspace(ymin,ymax,8); zrange = 3:4:15; [cx cy cz] = meshgrid(xrange,yrange,zrange);
Draw the cones, setting the scale factor to 5 to make the cones larger than the default size:
hcones = coneplot(x,y,z,u,v,w,cx,cy,cz,5);
Use the jet colormap:
Calculate the magnitude of the vector field (which represents wind speed) to generate scalar data for the slice command:
hold on wind_speed = sqrt(u.^2 + v.^2 + w.^2);
Create slice planes along the x-axis at xmin and xmax, along the y-axis at ymax, and along the z-axis at zmin:
hsurfaces = slice(x,y,z,wind_speed,[xmin,xmax],ymax,zmin);
set(hsurfaces,'FaceColor','interp','EdgeColor','none') hold off
Select perspective projection to provide a more realistic looking volume using camproj:
Zoom in on the scene a little to make the plot as large as possible using camzoom:
The light source affects both the slice planes (surfaces) and the cone plots (patches). However, you can set the lighting characteristics of each independently.
camlight right; lighting gouraud
Increase the value of the AmbientStrength property for each slice plane to improve the visibility of the dark blue colors:
Increase the value of the DiffuseStrength property of the cones to brighten particularly those cones not showing specular reflections: