Best way to display 3 variables with a scatter plot

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 Kommentare

Have you considered scatter3?
^if you can't use scatter3 for whatever reason, you can make 3 subplots with one set of data for each except you add the average density lines (probably not the correct name, but it's basically a boundary line that encompasses about 90-95% of the data points) for the other data sets on each plot for comparison.
Flo
Flo am 9 Sep. 2016
Thank you for you help!
I prefer not to use a scatter3, for the same reasons: it's hard to distinguish anything out of this graph.
mbonus: when you talk about a density lines, which function are you thinking about. It sounds interesting but I am unsure about what you are trying to explain.
I'll try three subplots for the moment
Flo
mbonus
mbonus am 12 Sep. 2016
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.
mbonus: sounds sort of like a box plot.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 13 Sep. 2016

0 Stimmen

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 Kommentare

Flo
Flo am 13 Sep. 2016
I tried to play with those two parameters already, but they didn't permit me to access the dot properties.
Which MATLAB version are you using? And please explain what you mean about "access dot properties"

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Discrete Data Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

Flo
am 8 Sep. 2016

Kommentiert:

am 13 Sep. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by