How can I plot Latitude and Longitude in a map, color depending on a certain value

3 Ansichten (letzte 30 Tage)
Hi there, I am new at Matlab and I have the following problem: I have two vectors with values for longitude and latitude (70x1) and I have a matrix (100x71) which has a date in the first column and concentrations in the other 70 columns. Each column represents the values for lat and lon in the vektor, so matrix(1,3) = lon/lat(2,1). I now want to plot them in a map using plot_google_map and several for loops, so I get a map picture for each of the 100 dates. It's working fine if I define the color of every value range. But I would actually prefer to have the color as a function of the concentration and the map with a colorbar.
for k = 1:100;
for i = 1:70;
if Con(k,i+1) >= 0 & Con(k,i+1) < 10;
plot(lon1(i),lat1(i),'Marker','.','Color',colormap,'LineStyle','none','MarkerSize',20)
end
if Con(k,i+1) > 10 & Con(k,i+1) < 20;
plot(lon1(i),lat1(i),'Marker','.','Color',blue,'LineStyle','none','MarkerSize',20)
end
if Con(k,i+1) > 20 & Con(k,i+1) < 30;
plot(lon1(i),lat1(i),'Marker','.','Color',light_blue,'LineStyle','none','MarkerSize',20)
end
hold on
end
plot_google_map('maptype','terrain','style',styleParams)
saveas(gcf,sprintf('figure%d.jpg', k))
end
I hope anyone can help me. Thank you!!

Antworten (1)

Marc Jakobi
Marc Jakobi am 6 Okt. 2016
Maybe contour() would work better instead of plotting in a loop.

Kategorien

Mehr zu 2-D and 3-D 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!

Translated by