How to plot points on map axes with varying colors using scatterm?
Mostrar comentarios más antiguos
I have three vectors: lat, lon, depth. They are of equal length. When I run the code below, I get an error saying: Error using scatter
Color must be one RGB triplet, an m-by-3 matrix of RGB triplets with one color per scatter point, or an m-by-1 vector with one value per scatter point.". I don't understand, because my depth vector, which is being used for color, is the same size as my latitude vector.
%Load in data
data = readmatrix("Lin14_cores.csv","NumHeaderLines",1);
lon = data(:,1);
lat = data(:,2);
depth = data(:,4);
%Plot datapoints on map axes with colors showing depth
load coastlines
ax = axesm("MapProjection","mollweid","MapLatLimit",[-60 60], "MapLonLimit",[-180 180], 'Frame', 'on');
plotm(coastlat,coastlon)
scatterm(ax, lat,lon, ones(length(lat))*50, depth);
colormap("autumn")
Can anyone help me fix this.
Respuesta aceptada
Más respuestas (1)
Manas
el 16 de Jun. de 2023
0 votos
Hi Samuel,
Can you provide the coastlines file?
Also, you can checkout this answer and try out if it works for you
Categorías
Más información sobre Geographic Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!