0

I have produced the following figure using MATLAB plot3 function.

enter image description here

This figure is not good. Because, I think, it's too hard for readers to estimate the coordinates from this figure. Points height (Z value) is too hard to be estimated from the figure. What is missing in my figure that makes it hard to be interpreted ?


To Play with the data: The visualized data is here. The function to produce my current figure is here. Either comment the mArrow3 call, or download it from here.

gariepy
  • 3,576
  • 6
  • 21
  • 34
Hesham Eraqi
  • 2,444
  • 4
  • 23
  • 45

4 Answers4

3

To better see height you can use stem3 to draw a vertical line from the floor to each point. You can enhance the representation with a semi-transparent patch at zero height to highlight the floor.

% // Random data
x = -20+50*rand(1,50);
y = 150*rand(1,50);
z = -5+10*rand(1,50);

%// With plot
figure
plot3(x,y,z,'.','markersize',8)
grid on
axis equal
view(-33, 14)

%// With stem3 and patch
figure
stem3(x,y,z,'.','markersize',8)
grid on
hold on
patch([-20 30 30 -20], [0 0 150 150], [0 0 0 0], 'k', ...
    'edgecolor', [.5 .5 .5], 'FaceAlpha' , .1)
axis equal
view(-33, 14)

enter image description here enter image description here

Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
1

I think the problem might be intrinsic to these kind of plots: the 0d dots of your data are hard to interpret perspectivically, your brain can't decypher at which depth the data points are located. For instance, it would seem to me that you have no data poinst above z=0 and above x=15, which is obviously wrong, but my brain attributes most of your points to the z=-5 plane.

Unless your data points have finite volume which proportionally changes with distance (which can not be done with matlab, and probably wouldn't help much anyway), you might want to reconsider your way of visualization. How about having 3 plots, one each with camera along the x, y, and z axes?

EDIT: the suggestion of Luis Mendo makes me think I should probably have a more open mind when trying to answer a question:)

Community
  • 1
  • 1
1

You could also use different colors/markers/point size to discriminate between various regions in your data. For instance values having z below 0 are red and those above are green. Here is a simple example using scatter3 with 4 distinct regions. Thanks to Luis Mendo for the dummy data.

clc;clear;close all


% // Random data...thanks Luis Mendo
x = -20+50*rand(1,50);
y = 150*rand(1,50);
z = -5+10*rand(1,50);

%// Get indices for various regions in your data
region1 = find(z>=-4 & z<-2);
region2 = find(z>=-2 & z<0);
region3 = find(z>=0 & z<2);
region4 = find(z>=2 & z<4);

%// Draw each region with its own color/size
scatter3(x(region1),y(region1),z(region1),20,'r','filled')
hold on
scatter3(x(region2),y(region2),z(region2),40,'y','*')
scatter3(x(region3),y(region3),z(region3),60,'g','filled')
scatter3(x(region4),y(region4),z(region4),80,'b')

grid on

view(-33, 14)

enter image description here

Benoit_11
  • 13,905
  • 2
  • 24
  • 35
  • Good idea, I actually thought about it but I wanted to create a heat map. So, the dot color is proportional to the dot Z value. But I failed. – Hesham Eraqi Jul 21 '15 at 14:54
  • Sure! Of course you could automate all the region selection thing so that you don't enter them manually. – Benoit_11 Jul 21 '15 at 14:57
  • I've found a good answer for the heat map: [here](http://stackoverflow.com/questions/29349336/produce-a-3d-stem-plot-with-a-custom-colormap-in-matlab/29357396#29357396). But I will keep the question not answered for now to hear maybe better thoughts. – Hesham Eraqi Jul 21 '15 at 15:14
  • Yes the answers really look very good! – Benoit_11 Jul 21 '15 at 15:16
0

kkuilla's answer about heat map produced a much better result:

enter image description here

Community
  • 1
  • 1
Hesham Eraqi
  • 2,444
  • 4
  • 23
  • 45