How to make a 3D scatterplot with perspective

I need to create a 3D scatterplot that looks something like this:
Where X is left-right, Y is depth, and Z is height.
I have arrays of X, Y and Z points and have been playing with scatter3(), but need perspective in the Y direction to better show position, and other things like turning off the Z axes, etc. Is this possible?

回答 (1 件)

Star Strider
Star Strider 2018 年 3 月 27 日

5 投票

See the documentation on the Axes Properties (link) 'Projection' (link) property.
For example:
set(gca, 'Projection','perspective')

3 件のコメント

Dave Woodall
Dave Woodall 2018 年 3 月 27 日
Thanks, that fixed the perspective issue:
The remaining problems are: 1) turning off the X and Y grids in the Z dimension, and 2) reducing the amount of real estate given to the Z dimension and increasing it in Y.
My code is below. It seems that in scatter3(), the X and Y grids automatically extend up into the Z dimension. I haven't found a way to turn that off. The Z grid is actually off.
scatter3(x, y, z, s, coltab, 'filled');
set(gca, 'Projection','perspective');
set(gca,'color', [0 0 0]);
ax.XAxis.Color = [0.6 0.6 0.6];
ax.YAxis.Color = [0.6 0.6 0.6];
ax.ZAxis.Color = [0.6 0.6 0.6];
% ax.GridColor = [0.6 0.6 0.6];
ax.GridColor = [1 0 0];
ax.GridAlpha = 0.5;
ax.XGrid = 'on';
ax.YGrid = 'on';
ax.ZGrid = 'off';
ax.YTick = 0:1:ylimit;
xlim([-xlimit xlimit]);
ylim([0 ylimit]);
zlim([0 zlimit]);
view(0, 10); % azimuth elevation
Star Strider
Star Strider 2018 年 3 月 27 日

I can’t figure out what you want to do. You already seem to have done much of what I’d have suggested.

See if the options in the grid (link) or box (link) functions will do what you want.

KAE
KAE 2019 年 7 月 30 日
I am confused by your picture. The dots all look the same size. Didn't you want faraway dots to look smaller and closer dots to look bigger?

サインインしてコメントする。

カテゴリ

質問済み:

2018 年 3 月 26 日

コメント済み:

KAE
2019 年 7 月 30 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by