Best to represent two large data sets in one plot

2 visualizzazioni (ultimi 30 giorni)
Flo
Flo il 26 Ago 2016
Commentato: Image Analyst il 30 Ago 2016
Hi everyone,
I am dealing with a scatter plot on which I'd like to plot two data sets containing at least 1500 dots per dataset. This number can reach 10000.
So far I am plotting those points by using a scatter plot:
Do you think Matlab offers a better way to show my data?
Thank you, Flo

Risposte (1)

Image Analyst
Image Analyst il 26 Ago 2016
Depends on what you want to do or show. One option is you could create an image where you put one set into the red channel and one into the blue channel. Then you could increment a pixel to make it brighter when you happen to have multiple data values with the same x,y location. It will also let you see both sets at the same time (overlaps will be purplish) instead of the blue set, which you plotted last, covering up and totally obscuring the red data.
  2 Commenti
Flo
Flo il 29 Ago 2016
Interesting way of doing it. I will try to find out how to do that. thank you
Image Analyst
Image Analyst il 30 Ago 2016
Try to adapt this:
fontSize = 15;
numPoints1 = 5000;
set1x = rand(numPoints1, 1);
set1y = 25 * rand(numPoints1, 1);
numPoints2 = 4000;
set2x = rand(numPoints2, 1);
set2y = 25 * rand(numPoints2, 1);
subplot(2, 2, 1);
plot(set1x, set1y, 'r.');
hold on;
plot(set2x, set2y, 'b.');
grid on;
title('Scatterplot', 'FontSize', fontSize);
% Make an image
rows = 300;
columns = 400;
redChannel = zeros(rows, columns);
blueChannel = zeros(rows, columns);
maxX1 = max(set1x);
maxY1 = max(set1y);
maxX2 = max(set2x);
maxY2 = max(set2y);
% Assign set 1 to red channel
for k = 1 : numPoints1
thisX = round(set1x(k) * columns / maxX1);
thisY = round(set1y(k) * rows / maxY1);
if thisX < 1
thisX = 1;
end;
if thisY < 1
thisY = 1;
end;
redChannel(thisY, thisX) = redChannel(thisY, thisX) + 1;
end
subplot(2,2,2);
imshow(redChannel, []);
title('Set 1', 'FontSize', fontSize);
% Assign set 2 to blue channel
for k = 1 : numPoints2
thisX = round(set2x(k) * columns / maxX2);
thisY = round(set2y(k) * rows / maxY2);
if thisX < 1
thisX = 1;
end;
if thisY < 1
thisY = 1;
end;
blueChannel(thisY, thisX) = blueChannel(thisY, thisX) + 1;
end
subplot(2,2,3);
imshow(blueChannel, []);
title('Set 2', 'FontSize', fontSize);
% Make RGB image
rgbImage = cat(3, mat2gray(redChannel), zeros(rows, columns), mat2gray(blueChannel));
subplot(2,2,4);
imshow(rgbImage, []);
title('both in an RGB image', 'FontSize', fontSize);

Accedi per commentare.

Categorie

Scopri di più su Visual Exploration in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by