To make it easier to visually interpret 3D data when shown on a 2D surface like the computer screen, I would like to plot data so that far-away markers appear smaller and nearby markers appear larger. Choosing the 'Perspective' axes projection seems to make no difference in marker size,
figure;plot3(rand(1,10), rand(1,10), rand(1,10), 'ko')ax = gca;ax.Projection = 'perspective';
To me, all makers appear to be the same size here.
Next I tried making the markers actual 3D spheres. This works but it's fussy, and it still doesn't meet my aim of making it easier to read a 2D picture of a 3D plot,
nFace = 200; % Radius of sphere in plot units
[x,y,z] = sphere(nFace); % Create a sphere which we will replicate
sphereScale = 50; % Need to scale values so that spheres appear small, like markers
% xyz locations of sphere centers
xCenter = rand(1,10)*sphereScale - sphereScale/2; yCenter = rand(1,10)*sphereScale - sphereScale/2;zCenter = rand(1,10)*sphereScale - sphereScale/2;% Plot the spheres/makers
figure;for iSphere = 1:length(xCenter) % Plot several spheres
s(iSphere) = surf(x + xCenter(iSphere),... y + yCenter(iSphere),... z + zCenter(iSphere)); hold on;endaxis equal; % Make spheres appear like smooth 3D markers
set(s, 'facecolor', [1 1 1]*0.8, 'facealpha', 1, 'edgecolor', 'none', 'clipping','off');ax = gca; ax.Projection = 'perspective'; % This should result in foreshortening in the plot
view(30, 15);% Add lighting to make spheres appear 3D
lightangle(-45,30)h.FaceLighting = 'gouraud';h.AmbientStrength = 0.3;h.DiffuseStrength = 0.8;h.SpecularStrength = 0.9;h.SpecularExponent = 25;h.BackFaceLighting = 'unlit';
I still can't tell which markers are 'nearer' and which are 'farther', though, so the 3D information in this plot is still hard to interpret visually.
Best Answer