Opening the book…
MATLAB also has plotting functions for three-dimensional data. Many of these functions have names similar to their two-dimensional versions, but with a 3 at the end.
|
2D function |
3D function |
Description |
|
plot |
plot3 |
Plots points or lines in 3D. |
|
bar |
bar3 |
Creates a 3D bar plot. |
|
pie |
pie3 |
Creates a 3D pie chart. |
|
stem |
stem3 |
Creates a 3D stem plot. |
Creating various three-dimensional plots.
clear; clc; clf;
% using plot3 function
x = 1:5;
y = [0 -2 4 11 3];
z = 2:2:10;
subplot(1,3,1)
plot3(x, y, z, 'k*')
grid on
xlabel('x')
ylabel('y')
zlabel('z')
title('3D Point Plot')
% using bar3 function
x = 1:6;
y = [33 11 5 9 22 30];
subplot(1,3,2)
bar3(x, y);
grid on
ylabel('x')
zlabel('y')
title('3D bar Plot')
% using pie3 function
subplot(1,3,3)
pie3([3 10 5 2])
title('3D pie chart')
Solution

A 3D plot uses x, y, and z coordinates. This can be helpful when each data point has three related values.
This page titled 10.11: Three-Dimensional Plots was last modified on Tue, 30 Jun 2026 02:11:46 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Zara Noroozi.
The book could not be loaded just now.