Hi,
h = figure;
set(h, 'Color','w')
imagesc(X,Y,wet'); set(gca,'YDir','normal'); set(gca,'YDir','normal');
%hold on, plot(long,lat); set(gca,'YDir','normal')
set(gca,'FontSize', 12, 'FontWeight','bold')
title('WET SEASON','FontSize', 12, 'FontWeight','bold')
h = colorbar; set(h,'FontSize', 12, 'FontWeight','bold')
mymap = [1 0.8 1; 0.7 1 1; 0.9 1 0.5; 0.6 0.7 0];
caxis([0 360]); colormap(mymap)
I want to add India boundary to this figure for which I have a shapefile. I have tried using shaperead and geoshow but it's not working and I am really got stuck into it. Any help will be highly appreciated. Thanks Praveen

8 件のコメント

jonas
jonas 2018 年 7 月 5 日
編集済み: jonas 2018 年 7 月 5 日
Can you provide some data and the shapefile so that we can run your code? Please also format the code ( link )
praveen rai
praveen rai 2018 年 7 月 5 日
編集済み: Chad Greene 2018 年 8 月 14 日
cd('/home/pkumar')
load('wet_dry_season')
load('coast')
h = figure;
set(h, 'Color','w')
imagesc(X,Y,wet');
set(gca,'YDir','normal');
%hold on, plot(long,lat); set(gca,'YDir','normal')
set(gca,'FontSize', 12, 'FontWeight','bold')
title('WET SEASON','FontSize', 12, 'FontWeight','bold')
h = colorbar; set(h,'FontSize', 12, 'FontWeight','bold')
mymap = [1 0.8 1; 0.7 1 1; 0.9 1 0.5; 0.6 0.7 0];
caxis([0 360]); colormap(mymap)
The size of data for current code is large, so i can't attach here. But I am attaching the figure on which i want to draw boundary and I have also attached .shp file.
jonas
jonas 2018 年 7 月 5 日
1. You format code by selecting the text and click the '{} Code' button.
It looks like this
2. What happens if you draw the shapefile on an empty map? Possibly, your country boundaries appear under the data. No way for me to tell if I don't have the shapefile nor the data (nor the code, as there is no geoshow nor shaperead present).
praveen rai
praveen rai 2018 年 7 月 6 日
clc; clear all; close all;
cd('/home/pkumar')
load('wet_dry_season')
load('coast')
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%plot wet season
%%%%%%%%%%%%%%%%%%%%%%%%%%%
h = figure;
set(h, 'Color','w')
S=shaperead('Export_Output_3.shp');
mapshow(S);
imagesc(X,Y,wet'); set(gca,'YDir','normal'); set(gca,'YDir','normal');
%hold on, plot(long,lat); set(gca,'YDir','normal')
set(gca,'FontSize', 12, 'FontWeight','bold')
title('WET SEASON','FontSize', 12, 'FontWeight','bold')
h = colorbar; set(h,'FontSize', 12, 'FontWeight','bold')
mymap = [1 1 1; 0.6 1 0.3; 0.6 0.8 0.4; 0.5 0.6 0.2; 1 0.3 0.9; 1 0 0; 0.9 1 0.3; 0.5 0 1];
caxis([0 360]); colormap(mymap)
Sorry for the inconvenience Jonas. I am attaching the .shp file. And when I am using mapshow, the boundaries are not showing, only the figure comes which i have attached above.
jonas
jonas 2018 年 7 月 6 日
Something wrong with the coordinates of your shapefile. Use this one from ArcGis instead ( link ). See attachment for results.
I=shaperead('INDIA.shp');
mapshow(I,'facecolor','none');
praveen rai
praveen rai 2018 年 7 月 7 日
Thanks Jonas. It works now
jonas
jonas 2018 年 7 月 7 日
Nice! Happy to help
Ankit Singh
Ankit Singh 2019 年 6 月 30 日
Thanks..
It works now.

サインインしてコメントする。

 採用された回答

Chad Greene
Chad Greene 2018 年 8 月 14 日

0 投票

Alternatively, if you don't have Matlab's Mapping Toolbox you can use my borders function.

2 件のコメント

praveen rai
praveen rai 2018 年 8 月 14 日
I have tried that border function Chad...it has also served my purpose. Just a small query... I want to calculate significant trend using Mann-kendall on a 3-dimensionsl data which contains lat, lon and Julian days value at each grid. Can you please help me in solving this?
Many thanks
Chad Greene
Chad Greene 2018 年 8 月 14 日
Hi Praveen, That's a somewhat involved task I don't have a tidy solution for. I recommend starting a new question with some sample data and maybe someone on the forum can help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by