How to label feature of shape file when calling it by geoshow and how to make multiple maps in single file

19 Ansichten (letzte 30 Tage)
I am trying to make color map from text file data.I am using geoshow to call shape file of the region to set back ground of the color map.My shape file is the country. I have digitized its districts as polygons. In the attributes of the shape file i named these districts under "NAME_1" field.I am using that codes to make a color map
fid = fopen('1000_2000.txt');
C = textscan(fid, '%f %f %f')
fclose(fid);
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]);
xlabel('Longitude');
ylabel('Latitude');
set(gca,'CLim',[0,3000])
colorbar
I am getting output as
I want such kind of label features( want to show label in the attribute of shape file with field name NAME_1)
Any idea how to correct these code to label features on my color maps. Thanks in advance for this kind assistance

Akzeptierte Antwort

Usha Duddu
Usha Duddu am 29 Jul. 2015
Hi Muhammad
I understand that you are trying to display labels on your color map created using geoshow function. In order to do this you can use text function. The 'X' and 'Y' values in the 'text' function will correspond to the latitude and longitude of the districts.
For example- If you want to label Baluchistan, you can use text(66,28,'Baluchistan') where 66 corresponds to X coordinate and 28 corresponds to Y coordinate.
Here is a simplified example code snippet for your reference-
>>a=axes;
>>S = shaperead('landareas','UseGeoCoords',true);
>>geoshow([S.Lat], [S.Lon],'Color','black');
>>text(-125,50,'America')
I hope this helps.
Usha
  2 Kommentare
Muhammad Usman Saleem
Muhammad Usman Saleem am 30 Jul. 2015
@Usha Duddu thank you very much for giving me solution. Please if you do not mind , may i ask little more assistance from you??
(1) I want to make 12 color maps(for complete one year , like see the below given 12 color maps in the pic) , is this possible i can make 12 such color maps for such column arrangements in matalb?( Please see also that all these 12 color maps have one color scale)
Thanks in advance for assistance and you have a good day
Muhammad Usman Saleem
Muhammad Usman Saleem am 30 Jul. 2015
actually i want to save time. That why i want i can make such color maps. I know how to makes simultaneously 12 color maps but i do not know how to set them in 3 columns and 4 rows. Thanks for understanding my views.
Regards;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by