Changing color of points plotted with scatterm
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
McKenzie Mandich
am 1 Nov. 2018
Beantwortet: Amy Haskins
am 1 Nov. 2018
Hi all,
I am trying to plot 11 coordinates on a map and have each point be a different colour (the colours will correspond to nutrient depth profiles I've created). However, when I try to use scatterm to put the coordinates on the map, they simply don't show up. I don't get an error message. This is my code:
worldmap([43 50],[-65 -55]);
Lon = [-59.7835 -59.5573 -56.8097 -56.4387 -55.86887 -55.86718 -55.83538 ... -55.83361 -55.79864 -55.814 -63.3175];
Lat = [47.2708 47.432 44.8472 44.9195 44.92462 44.88346 44.82992 44.78269 ... 44.25512 43.73742 44.2675];
c = [1 1 0; 1 0 1; 0 1 1; 1 0 0; 0 1 0; 0 0 1; 1 1 1; 0 0 0; 1 0.4 0.6; ... 0.6 0.6 0.6; 0.7 0.1 0.1];
LandArea=geoshow('landareas.shp','FaceColor',[0.6 0.6 0.6]);
scatterm(Lat,Lon,2,c,'filled');
scaleruler on;
setm(handlem('scaleruler'),... 'MajorTick',0:100:200);
Previously I had labelled each coordinate with the site name using textm and this showed up fine. I also tried writing "c" as a color name but this did not work either. Matlab says c should be a vector or a three-column matrix of RGB triplets
Where am I going wrong/how can I make my coordinates show up with different colours?
Thank you!
0 Kommentare
Akzeptierte Antwort
Amy Haskins
am 1 Nov. 2018
It looks like the size is too small for the markers to be visible. I changed 2 to 25 in the line below leaving the rest of your code alone and I can see the markers.
scatterm(Lat,Lon,25,c,'filled');
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Scatter Plots 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!