Documentation Center

  • Trial Software
  • Product Updates


Plot velocity vectors as cones in 3-D vector field


h = coneplot(...)










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.



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.

load wind

Now establish the range of the data to place the slice planes and to specify where you want the cone plots (min, max):

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.


Decide where in data space you want to plot cones. This example selects the full range of x and y in eight steps and the range 3 to 15 in four steps in z using linspace and meshgrid.

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:


Use the jet colormap:

colormap jet

Set the coloring of each cone using FaceColor and EdgeColor:



hold on



Specify interpolated face color so the slice coloring indicates wind speed, and do not draw edges (hold, slice, FaceColor, EdgeColor):

hold off

Use the axis command to set the axis limits equal to the range of the data. axis tight. Orient the view to azimuth = 30 and elevation = 40. (rotate3d is a useful command for selecting the best view.)

view(30,40);axis off

Select perspective projection to provide a more realistic looking volume using camproj:

camproj perspective;

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.

Add a light source to the right of the camera and use Gouraud lighting to give the cones and slice planes a smooth, three-dimensional appearance using camlight and lighting:

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:


See Also

| | | | | | |


Was this topic helpful?