필터 지우기
필터 지우기

Best way to display 3 variables with a scatter plot

조회 수: 7 (최근 30일)
Flo
Flo 2016년 9월 8일
댓글: Walter Roberson 2016년 9월 13일
Hello everyone,
I am dealing with a small problem, and maybe some of you may have a better idea than me. So here is the story: I am having large datasets to display. By large I mean between 4K to 10K dots. I am using a scatter plot for that. I plot Y as a function of X and so far the results/display are ok. But I'd like to add the Z variable on the top of that.
My original idea was to display Z as a color variation. it goes from x.10-4 to ~5, and most of my values are very low: the result was few dots were yellowish and the rest was dark blue.
The second idea was to display the first, second and third quartile, with a color for each of them. I lose in resolution but I would have roughly my lower values in let's say blue, then red for 50% of my data, and finally the last 25% would be green. Here again the density of dots makes the graph difficult to read: the green is on the top of the red which is on the top of the blue....
Can I control the alpha with a scatter plot (as far as I've searched, I don't think so). Do you think of a better idea to display amount of dots in respects of the Z variable?
Here is my code :
temp = [X,Y,Z];
temp3= sortrows(temp,3);
N = length(X);
Q1= ceil(N/4);
Q3=ceil((3*N)/4);
a1=temp3(1:Q1,1);
b1=temp3(1:Q1,2);
c1=temp3(1:Q1,3);
a2 = temp3(Q1:Q3,1);
b2= temp3(Q1:Q3,2);
c2 = temp3(Q1:Q3,3);
a3=temp3(Q3:N,1);
b3=temp3(Q3:N,2);
c3=temp3(Q3:N,3);
figure();
scatter(a1(:),b1(:),10,c1(:), 'O', 'filled', 'b');
hold on;
scatter(a2(:),b2(:),10,c2(:), 'O', 'filled', 'r');
hold on;
scatter(a3(:),b3(:),10,c3(:), 'O', 'filled', 'g');
hold on;
axis( [0 1 1 5]);
Thank you for your help. Let me know if you need further information :)
Cheers, Flo
  댓글 수: 5
mbonus
mbonus 2016년 9월 12일
To the best of my knowledge it's not a function in MATLAB but Excel does have it. For every x value you would find a percentage confidence value. This value is how much you can reasonably expect your data to deviate from the average with the confidence chosen. If you vectorize the calculation then you can plot it without a loop.
Walter Roberson
Walter Roberson 2016년 9월 13일
mbonus: sounds sort of like a box plot.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 9월 13일
scatter() does not allow the alpha to be controlled on a per-point basis. It does, however, allow you to pass 'MarkerEdgeAlpha' and 'MarkerFaceAlpha' as scalars that affect all points drawn with that call.
  댓글 수: 2
Flo
Flo 2016년 9월 13일
I tried to play with those two parameters already, but they didn't permit me to access the dot properties.
Walter Roberson
Walter Roberson 2016년 9월 13일
Which MATLAB version are you using? And please explain what you mean about "access dot properties"

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by