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

4 次查看(过去 30 天)
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!!

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by