I think there are two things going wrong in your example:
- MATLAB is drawing faces you don't want because you have four rows in
xf
, yf
and zf
... edges are drawn between horizontally and vertically adjacent points.
- The last column of
xf
(similarly yf
and zf
) should be the same as the first, to "close" the box (i.e. draw the one vertical wall you're missing)
My solution:
After some playing, it looks like one solution is to define your xf
, yf
, and zf
as follows:
zf
= 2-by-n matrix, top row all zeros, bottom row all the desired height of the walls (for you, 0.1; for my example below, 1)
xf
= 2-by-n matrix, top and bottom rows identical, giving the latitude coordinates of the square defining your region
- Similarly,
yf
= 2-by-n matrix, top and bottom rows identical, giving the longitude coordinates of the square defining your region.
Important notes:
- the first and last columns of
xf
, yf
, and zf
should be identical to "close" the room
xf
corresponds to latitude which is actually y
coordinates here, and vice-versa for yf
One Wall:
Just trying to get a feel for geoshow
I started with one wall:
geoshow([1 1; 1 1], [0 1; 0 1], [0 0; 1 1], ...
'displaytype','surface','facecolor','red','facealpha',0.5);
view(3); xlabel('x'); ylabel('y'); zlabel('z');
Notice the first input (all 1's) corresponds to the y-values, since they are latitudes:

Two Walls:
I added another column to each xf
, yf
, and zf
:
geoshow([1 1 0; 1 1 0], [0 1 1; 0 1 1], [0 0 0; 1 1 1],...
'displaytype','surface','facecolor','red','facealpha',0.5);
view(3); xlabel('x'); ylabel('y'); zlabel('z');
(note: I adjusted the axis here to match the first picture for consistency)
Three Walls:
I added another column to each xf
, yf
, and zf
:
geoshow([1 1 0 0; 1 1 0 0],[0 1 1 0; 0 1 1 0],[0 0 0 0; 1 1 1 1],...
'displaytype','surface','facecolor','red','facealpha',0.5);
view(3); xlabel('x'); ylabel('y'); zlabel('z');
(note: there is no top on the "box")
Four Walls:
I added another column (a copy of the first column) to each xf
, yf
, and zf
:
geoshow([1 1 0 0 1; 1 1 0 0 1],[0 1 1 0 0; 0 1 1 0 0],[0 0 0 0 0; 1 1 1 1 1],...
'displaytype','surface','facecolor','red','facealpha',0.5);
view(3); xlabel('x'); ylabel('y'); zlabel('z');

Ta-da! To convince you there's no top on the box:
