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.
The example 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); % peaks function on a polar grid
% draw 3d polar plot
'AngularRange',[30 270]*pi/180,'RadialRange',[.8 4],...
% set plot attributes
set(gca,'DataAspectRatio',[1 1 10],'View',[-12,38],...
'Xlim',[-4.5 4.5],'Xtick',[-4 -2 0 2 4],...
'Ylim',[-4.5 4.5],'Ytick',[-4 -2 0 2 4]);
The zip file contains the polarplot3d function and an m-file with example plots.
Ken Garrard (2023). 3D Polar Plot (https://www.mathworks.com/matlabcentral/fileexchange/13200-3d-polar-plot), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: 3D Polar Plot
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Replaced optional 'PlotProps' cell argument with 'property',value list and added 'RadLabels', 'RadLabelLocation' and 'RadLabelColor' properties.
This update supports non-uniform spacing of the rows and columns of the input data matrix, allows more control over the polar grid overlay and removes the dependency on PARSE_PV_PAIRS.
Added surface coloring property.