Geoscatter plot with different colors

34 visualizzazioni (ultimi 30 giorni)
em_++
em_++ il 3 Ago 2021
Risposto: Walter Roberson il 3 Ago 2021
Hi everyone!
I am trying to do some plotting wit geographical data.
So I've got Latitude and Longitude, which I want to plot on a map; the third data is a dataset consistion of 0s and 3s. (All Arrays have the same length) So always when its a 3 it sould be green and always when its 0 it should be red.
Could you please help me.
My first try was this:
LockNo = find(Lock == 0)
LockFull = find(Lock==3)
plot(x(LockNo),y(LockNo),'r.',x(LockFull),y(LockFull),'g.');
Thank you in advance!

Risposte (1)

Walter Roberson
Walter Roberson il 3 Ago 2021
dot_color = repmat([1 0 0], length(Lock), 1);
dot_color(Lock == 3, :) = [0 0 1];
lat = y; long = x;
pointsize = 20;
scatterm(lat, long, pointsize, dot_color)
or
cmap = [1 0 0; 0 0 0; 0 0 0; 0 0 1];
lat = y; long = x;
pointsize = 20;
scatterm(lat, long, pointsize, cmap(Lock+1,:));

Categorie

Scopri di più su Geographic Plots 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