Polarplot3d produces surface, mesh, wireframe and contour plots for three dimensional polar data. A labeled polar axis is drawn at a fixed height or it can follow the surface contour at maximum radius. A polar grid can also be drawn on top of the surface.
This function is based on polar3d by J De Freitas, file exchange ID 7656.
The input parameters are a matrix of magnitudes, Zp, and a list of property,value pairs that modify the default plot behavior. Each column of Zp contains information along a single half-meridian and each row gives height values along a circular arc. By default Zp is assumed to be increasing in radius down each column and increasing in angle (counter-clockwise) along each row. The default plot is drawn over a full circle of unit radius.
'RadialRange' and 'AngularRange' properties can be used to specify the upper and lower angular and radial values over which the data is plotted. The relative ordering of the angular and radial range vectors is used to determine the angular and radial direction sense of the rows and columns of Zp. Alternatively a vector can be specified giving the locations of each row or column.
The polar axis can be placed at the minimum, maximum or mean value of Zp at the largest radius, at the top or bottom of the plot box, at a user specified location, or it can follow the surface at the perimeter of the data. The polar axis tick mark spacing can be adjusted with the 'TickSpacing' property.
The default polar axis orientation is that zero degrees is along the +X axis and increasing angles are counter-clockwise. The 'PolarDirection' property can be used to change this to a compass style plot with zero degrees along the +Y axis and increasing angles going clockwise around the pole.
Default surface coloring is according to the values in Zp. This can be changed by supplying a matrix the same size as Zp as the value of the 'ColorData' property.
A scaling parameter can be specified to interpolate the data onto a finer or coarser mesh. The output Cartesian data is returned in three matrices.
Example
The plot in the screenshot was produced with the following commands.
[t,r] = meshgrid(linspace(0,2*pi,361),linspace(-4,4,101));
[x,y] = pol2cart(t,r);
P = peaks(x,y);
figure('color','white');
polarplot3d(P,'colordata',gradient(P));
view([-18 72]);
The zip file contains the polarplot3d function and a published m-file with example plots.
Versions
1 Original function based on POLAR3D by J De Freitas
2 Changed argument method to 'property',value pairs using PARSE_PV_PAIRS
2.1 Added 'ColorData' property
2.2 Updated contour plot implementation
2.3 Added radial and azimuthal mesh scale factors
2.4 Added 'CartOrigin' property
2.5 Added 'PolarAxisColor', 'GridColor', 'TickColor' and 'TickLabelColor' properties
2.6 Added 'PolarDirection' and 'GridScale' properties
3 Removed PARSE_PV_PAIRS dependency
4 Support for non-uniform grid spacing. Removed redundant 'MeshL' plot type
|