I have an excel file which has 3 coloumns longitude,latitude and data.I want to make a colormap.How can I do that.I am attaching the data file and a picture which shows what I want to do.

1 commentaire

Ameer Hamza
Ameer Hamza le 26 Avr 2020
Is the data in excel file only corresponds to colormap or the background image too?

Connectez-vous pour commenter.

 Réponse acceptée

Ameer Hamza
Ameer Hamza le 26 Avr 2020
Modifié(e) : Ameer Hamza le 26 Avr 2020
try this
data = readmatrix('data.xlsx');
lat = data(:,1);
lon = data(:,2);
val = data(:,3);
latV = linspace(min(lat), max(lat), 100);
lonV = linspace(min(lon), max(lon), 100);
[latG, lonG] = meshgrid(latV, lonV);
valG = griddata(lat, lon, val, latG, lonG);
contourf(latG, lonG, valG, 100, 'LineColor', 'none')
colormap(jet)
colorbar

4 commentaires

TAPAS
TAPAS le 26 Avr 2020
I have a .grd file which contains the elevation data for the same region as above. Can I plot the data as background??
Ameer Hamza
Ameer Hamza le 26 Avr 2020
Can you share the file?
Ameer Hamza
Ameer Hamza le 26 Avr 2020
You can try to plot it over the .grd file by using hold on.
Ameer Hamza
Ameer Hamza le 26 Avr 2020
You can use this package to read .grd file: https://www.mathworks.com/matlabcentral/fileexchange/25683-grdread2 and read the discussion here to see how to plot it: https://www.mathworks.com/matlabcentral/answers/446756-plot-grd-file.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Color and Styling dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by