Plot 2D data colormap

201 ビュー (過去 30 日間)
Dusaucy Camille
Dusaucy Camille 2021 年 3 月 26 日
コメント済み: Nathan Hardenberg 2023 年 7 月 20 日
Hello,
I have a file with 3 columns: x,y and z and I would like to plot a 2D map with the value of data z at the coordinate (x,y) with a colorbar that is in the range of the z-data (z is not a function of x and y). My points are from an unscructured grid point. I already try to use scatter and pcolor but I did not succeed to do this.
Could you help me to do this ? Thank you in advance !!
Camille From Belgium
  3 件のコメント
darova
darova 2021 年 3 月 26 日
Better be to place your comment in the answer section
Bobby Fischer
Bobby Fischer 2021 年 3 月 27 日
Okay.

サインインしてコメントする。

採用された回答

Bobby Fischer
Bobby Fischer 2021 年 3 月 27 日
This could help:
x = -3 + 6*rand(50,1);
y = -3 + 6*rand(50,1);
v = sin(x).^4 .* cos(y);
F = scatteredInterpolant(x,y,v);
[xq,yq] = meshgrid(-3:0.1:3);
F.Method = 'linear';
vq1 = F(xq,yq);
figure(1), close(1), figure(1)
plot3(x,y,v,'mo')
hold on
mesh(xq,yq,vq1)
title('Nearest Neighbor')
legend('Sample Points','Interpolated Surface','Location','NorthWest')
view(2)
colormap default
colorbar
  1 件のコメント
Nathan Hardenberg
Nathan Hardenberg 2023 年 7 月 20 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by