Comparing two scatterplot matrices

I have these two 39x2 matrices that each form a similar grid when plotted. I would like a way to compare the differences between the two for the position of each point, preferably a histogram for the x-axis and a histogram for the y-axis that shows the amount of difference between the two, so as to illustrate any amount of "bowing" from one grid to the next. Here is how I plot these two grids together, followed by the two matrices:
figure('Name','Grid Comparison');
hold on;
scatter(mat1(:,1), mat1(:,2),3,'r');
scatter(mat2(:,1), mat2(:,2),3, 'g');
ax = gca;
ax.Color = 'k';
ax.YDir = 'reverse';
29.9 326.7 31.4 329.7
31.6 183.3 32.2 187.1
38.0 398.3 41.8 258.3
40.4 255.2 41.6 400.9
108.1 470.8 112.9 472.4
109.4 399.5 113.1 116.4
110.6 327.9 113.1 187.7
112.3 184.5 113.2 258.5
111.6 256.2 113.4 330.0
113.2 113.0 113.0 401.2
114.0 41.8 113.9 44.7
181.1 400.2 184.2 259.0
180.0 481.5 184.0 330.0
182.2 328.5 183.9 481.7
183.2 256.7 185.2 36.5
184.7 114.2 184.0 401.2
185.1 33.1 184.8 116.5
252.7 401.1 255.0 187.4
251.7 472.4 255.1 258.7
253.3 329.5 255.0 330.8
254.9 257.9 254.6 400.8
255.5 186.5 254.9 472.8
256.9 43.9 255.4 45.0
256.2 115.4 255.5 116.6
324.9 330.6 326.0 259.3
324.2 401.9 325.6 330.2
326.5 187.4 325.7 401.7
326.2 259.0 326.5 37.3
329.0 34.6 326.3 187.6
394.9 474.3 397.0 331.3
396.1 331.3 396.5 473.6
398.3 188.5 398.0 187.9
397.5 260.1 397.8 259.2
400.3 45.2 398.6 45.1
467.2 403.8 468.1 403.5
468.6 260.6 469.2 259.0
471.0 117.5 469.5 117.3
477.0 332.3 478.7 331.5
479.0 189.6 479.0 188.0

3 个评论

As I am not familiar enough with MATLAB enough to know of what functions would be useful for my endeavor, I have so far tried using the distance from each point to the origin to sort both matrices in the desired order. It does not worked perfectly tho as the differences between them appear to be large enough to throw off the order, such as these points being matched with each other:
31.61290323 183.3145161 185.2252252 36.54054054
185.1101695 33.13559322 32.22826087 187.1195652
Is there a simpler way to order the points as they would appear when plotted?
I've found a way that suffices to do the job I want for the proper sorting, but I was hoping for an easier way. This is the function I created to sort them.
ind = 1; sorted_array1 = zeros(39,2); sorted_array2 = zeros(39,2);
for i = 1:39
for j = 1:39
if abs(array1(i,1) - array2(j,1)) < 10 && abs(array1(i,2) - array2(j,2)) < 10
sorted_array1(ind,:) = array1(i,:);
sorted_array2(ind,:) = array2(j,:);
ind = ind + 1;
end
end
end
Make it easy for us. Attach your data and a screenshot. Maybe then someone will work on your problem.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by