Plot Heat map using latitude longitude and other vector
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi all, I want to plot a heatmap on a worldmap based on the latitude, longitude and power output of powerplants around the world, i.e, colour varies based on amount of power generated. I'm having issues using contourfm. Any suggestions on how to properly use contourfm or any other methods for heatmapping is much appreciated. I have the following code (attached with raw data files as well):
clear all;clc;
Location = uigetdir;
D = dir([Location, '\*.xlsx']);
filenames = {D(:).name}.';
data = cell(length(D),1);
worldmap world
load coastlines
[latcells, loncells] = polysplit(coastlat, coastlon);
numel(latcells);
axesmui;
antarcreg=coastlat < -63;
plotm(coastlat(~antarcreg),coastlon(~antarcreg))
whos;
for ii = length(D):-1:1
fullname = [Location filesep D(ii).name];
[~,txt,~] = xlsread(fullname,'I:I');
[num,~,~] = xlsread(fullname,'H:H');
num(isnan(num))=1;
if ismember(txt(1,:), 'point');
txt(1,:)='';
end
conv=char(txt);
conv=str2num(conv);
latitude=conv(:,1);
longitude=conv(:,2);
checklat=conv(:,1);
if length(checklat)==length(num);
x=linspace(min(latitude),max(latitude));
y=linspace(min(longitude),max(longitude));
[X,Y]=meshgrid(x,y);
F=scatteredInterpolant(latitude,longitude,num);
contourfm(latitude,longitude,num,'Linecolor','none');
end
end
0 comentarios
Respuestas (1)
KSSV
el 29 de En. de 2018
Let x,y,z be your longitude, latitude and data vector. You can plot the colormap using:
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
trisurf(tri,x,y,z) ;
shading interp ;
colorbar
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!