This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Plot 3-D point cloud


ax = pcshow(___)



pcshow(ptCloud) displays points using the locations and colors stored in the point cloud object.

pcshow(xyzPoints) displays points specified by the xyzPoints matrix.

pcshow(xyzPoints,C) displays points contained in the xyzPoints matrix, with colors specified by C.

pcshow(filename) displays the point cloud stored in the file specified by filename.

pcshow(___,Name,Value) uses additional options specified by one or more Name,Value pair arguments, using any of the preceding syntaxes.

ax = pcshow(___) returns the plot axes.


collapse all

Generate a sphere consisting of 600-by-600 faces.

numFaces = 600;
[x,y,z] = sphere(numFaces);

Plot the sphere using the default color map.

title('Sphere with Default Color Map');

Load and display an image for texture mapping.

I = im2double(imread('visionteam1.jpg'));

Resize and flip the image for mapping the coordinates.

J = flipud(imresize(I,size(x)));

Plot the sphere with the color texture.

title('Sphere with Color Texture');

Input Arguments

collapse all

Point cloud, specified as a pointCloud object.

Point cloud filename, specified as a character vector. The file must be supported by pcread. pcshow calls pcread to read the point cloud from the file, but does not store the data in the MATLAB® workspace.

Point cloud x, y, and z locations, specified as either an M-by-3 or an M-by-N-by-3 numeric matrix. The xyzPoints numeric matrix contains M or M-by-N [x,y,z] points. The z values in the matrix, which generally corresponds to depth or elevation, determine the color of each point. When you do not specify the C input color, the function maps the z value to a color in the current colormap.

Point cloud color of points, specified as one of:

You can specify the same color for all points or a different color for each point. When you set C to single or double, the RGB values range between [0, 1]. When you set C to uint8, the values range between [0, 255].

Points InputColor SelectionValid Values of C
xyzPointsSame color for all pointsColorSpec (Color Specification) color character vector or a 1-by-3 RGB vector

Different color for each pointVector or M-by-N matrix. The matrix must contain values that are linearly mapped to a color in the current colormap.

M-by-3 matrix or M-by-N-by-3 matrix containing RGB values for each point.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'VerticalAxisDir','Up' sets the vertical axis direction to up.

collapse all

Diameter of marker, specified as the comma-separated pair consisting of 'MarkerSize' and a positive scalar. The value specifies the approximate diameter of the point marker. MATLAB graphics define the unit as points. A marker size larger than six can reduce the rendering performance.

Vertical axis, specified as the comma-separated pair consisting of 'VerticalAxis' and a character vector specifying the vertical axis: 'X', 'Y', or 'Z'.

Vertical axis direction, specified as the comma-separated pair consisting of 'VerticalAxisDir' and a character vector specifying the direction of the vertical axis: 'Up' or 'Down'.

Output axes, specified as the comma-separated pair consisting of 'Parent' and an axes graphics object that displays the point cloud visualization.

Output Arguments

collapse all

Plot axes, returned as an axes graphics object.


To improve performance, pcshow automatically downsamples the rendered point cloud during interaction with the figure. The downsampling occurs only for rendering the point cloud and does not affect the saved points.


The pcshow function supports the 'opengl' option for the Renderer figure property only.

Introduced in R2015b