How do I plot points on a contour?
57 views (last 30 days)
Show older comments
data = readtable('Sample.xlsx');
ux1 = unique(data.x1);
nx1 = length(ux1);
X1 = reshape(data.x1, [], nx1);
X2 = reshape(data.x2, [], nx1);
Y = reshape(data.Y, [], nx1);
K = reshape(data.Kriging, [], nx1);
kerr = Y - K;
contourf(X1, X2, abs(kerr), 20);
colormap turbo
xlabel('x1')
ylabel('x2')
title('Sample(n=20)')
colorbar
caxis([0 1.5])
I want to mark the kriging.xlsx file on the contour.
Please let me know. Thank you
0 Comments
Accepted Answer
Star Strider
on 8 Jun 2021
I am not certain what result you want.
I plotted it with scatter3, however if the intent os to have lines connecting the points, use plot3.
data = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/645250/Sample.xlsx');
krin = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/645255/kriging.xlsx');
ux1 = unique(data.x1);
nx1 = length(ux1);
X1 = reshape(data.x1, [], nx1);
X2 = reshape(data.x2, [], nx1);
Y = reshape(data.Y, [], nx1);
K = reshape(data.Kriging, [], nx1);
kerr = Y - K;
figure
contourf(X1, X2, abs(kerr), 20)
hold on
scatter3(krin.x1, krin.x2, krin.kriging, 50, 'r', 'filled')
hold off
colormap turbo
xlabel('x1')
ylabel('x2')
title('Sample(n=20)')
colorbar
caxis([0 1.5])
.
0 Comments
More Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!