I am trying to make color map from text file data. I am using geoshow to call shapefile of the region and to set it as back ground of the color map. My shapefile is of the country. I have digitized its districts as polygons. In the attributes of the shapefile I named these districts under "NAME_1" field. I am using these codes to make a color map

fid = fopen('1000_2000.txt');
C = textscan(fid, '%f %f %f')
 f = {'lat', 'long', 'temp'}
 S = cell2struct(C,f,2);
 N = 100;
 [Xi, Yi] = meshgrid(linspace(60,80,N),linspace(20,40,N));
 Ci = griddata(S.long, S.lat, S.temp, Xi, Yi);
 f = figure; set(f, 'Renderer', 'painters')
 colormap default
  h = geoshow(Yi,Xi,Ci,'DisplayType','surface');
 set(h,'ZData', zeros(size(get(h,'XData'))));
 p = geoshow('PAK_adm1.shp', 'DisplayType','polygon','FaceColor','none','EdgeColor','w');
 xlim([60.5 78.5]);
ylim([22.5 38.5]);

I am getting output as

enter image description here

I want such kind of label features( want to show label in the attribute of shapefile with field name NAME_1)

enter image description here

Any idea how to correct these codes to label features on my color maps?


use the text command to write the text on the desire latitude and longitudes..

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.