Plotting problem & Does the matlab can plot raster map?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have coordinates (X,Y) and its corresponding value (Z), How to visualize them and distinguish with different color for each point? Just like a raster file that every pixel has a value in it.
Thank you very much!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/222619/image.png)
2 Kommentare
Akzeptierte Antwort
KSSV
am 4 Jun. 2019
Bearbeitet: KSSV
am 4 Jun. 2019
Let X,Y,Z be your m*3 data.
x = unique(X) ; nx = length(x) ;
y = unique(X) ; ny = length(y) ;
X = reshape(X,nx,ny) ;
Y = reshape(Y,nx,ny) ;
Z = reshape(Z,nx,ny) ;
figure
pcolor(X,Y,Z)
shading interp
figure
surf(X,Y,Z)
shading interp
9 Kommentare
KSSV
am 4 Jun. 2019
YOu have only two values in Z 0 and 1. You can plot them like below:
scatter(X(Z==1),Y(Z==1),'s','filled','r')
hold on
scatter(X(Z==0),Y(Z==0),'s','filled','b')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Mapping Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!