Error in longitude contour near the ploe MATLAB
up vote
1
down vote
favorite
I want to plot lat/lon contours at the south pole, my data consists of grid cells, each with a lat and lon value. My problem is where the longitudes "meets" each other, as you can see in the picture, the vertical longitude in the lower part of the picture have a lot of lines on top of each other.
Does anyone know how to remove them? Here is my code:
coldiv = -57.5:2.5:-7.5;
min_pr = coldiv(1); max_pr = coldiv(end);
cmap = [0 0 0.4; 0 0 0.7; 0 0 1; 0 0.2 1; 0 0.4 1; 0 0.6 1; 0 0.8 1; 0 1 1;
0 1 0; 0.6 0.8 0; 0.6 0.6 0; 0.6 0.4 0; 0.6 0.2 0; 1 0 0];
x = linspace(1,length(coldiv)-2,length(cmap));
xi = 1:length(coldiv)-2;
cmap = interp1(x,cmap,xi);
cmap = [0. 0. 0.; cmap];
fig=figure();
set(fig, 'Position', [10 10 1500 700])
pcolor(mean(tas_ann_DMI_hist_tot,3))
shading flat
hold on;
contour(flip_lat_DMI, 'k','ShowText','on');
contour(flip_lon_DMI, 'k','ShowText','on');
caxis([min_pr max_pr]);colormap(cmap);
axesHandles = findobj(get(fig,'Children'), 'flat','Type','axes');
axis(axesHandles,'square')
set(gca,'YTick',);
set(gca,'XTick',);
matlab matlab-figure latitude-longitude
|
show 1 more comment
up vote
1
down vote
favorite
I want to plot lat/lon contours at the south pole, my data consists of grid cells, each with a lat and lon value. My problem is where the longitudes "meets" each other, as you can see in the picture, the vertical longitude in the lower part of the picture have a lot of lines on top of each other.
Does anyone know how to remove them? Here is my code:
coldiv = -57.5:2.5:-7.5;
min_pr = coldiv(1); max_pr = coldiv(end);
cmap = [0 0 0.4; 0 0 0.7; 0 0 1; 0 0.2 1; 0 0.4 1; 0 0.6 1; 0 0.8 1; 0 1 1;
0 1 0; 0.6 0.8 0; 0.6 0.6 0; 0.6 0.4 0; 0.6 0.2 0; 1 0 0];
x = linspace(1,length(coldiv)-2,length(cmap));
xi = 1:length(coldiv)-2;
cmap = interp1(x,cmap,xi);
cmap = [0. 0. 0.; cmap];
fig=figure();
set(fig, 'Position', [10 10 1500 700])
pcolor(mean(tas_ann_DMI_hist_tot,3))
shading flat
hold on;
contour(flip_lat_DMI, 'k','ShowText','on');
contour(flip_lon_DMI, 'k','ShowText','on');
caxis([min_pr max_pr]);colormap(cmap);
axesHandles = findobj(get(fig,'Children'), 'flat','Type','axes');
axis(axesHandles,'square')
set(gca,'YTick',);
set(gca,'XTick',);
matlab matlab-figure latitude-longitude
Could you show what your desired output is?
– Mad Physicist
Nov 20 at 13:10
Ideally I want all the lines that are on top of each other removed. So there are line vertical lines between longitude -150 and 150
– Nicolaj Hansen
Nov 20 at 13:17
2
What about manually drawing meridians withline
orplot
? Drawing contour lines on longitudes is bound to fail where they suddenly drop from 180° to -180°. You may have to label meridians manually, though.
– Brice
Nov 20 at 13:52
1
Can you put a Minimal, Complete, and Verifiable example? Give us some random data for the variables not defined in your code
– Ander Biguri
Nov 20 at 14:43
1
Can't you use thepolaraxes
function ?
– obchardon
Nov 20 at 15:59
|
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I want to plot lat/lon contours at the south pole, my data consists of grid cells, each with a lat and lon value. My problem is where the longitudes "meets" each other, as you can see in the picture, the vertical longitude in the lower part of the picture have a lot of lines on top of each other.
Does anyone know how to remove them? Here is my code:
coldiv = -57.5:2.5:-7.5;
min_pr = coldiv(1); max_pr = coldiv(end);
cmap = [0 0 0.4; 0 0 0.7; 0 0 1; 0 0.2 1; 0 0.4 1; 0 0.6 1; 0 0.8 1; 0 1 1;
0 1 0; 0.6 0.8 0; 0.6 0.6 0; 0.6 0.4 0; 0.6 0.2 0; 1 0 0];
x = linspace(1,length(coldiv)-2,length(cmap));
xi = 1:length(coldiv)-2;
cmap = interp1(x,cmap,xi);
cmap = [0. 0. 0.; cmap];
fig=figure();
set(fig, 'Position', [10 10 1500 700])
pcolor(mean(tas_ann_DMI_hist_tot,3))
shading flat
hold on;
contour(flip_lat_DMI, 'k','ShowText','on');
contour(flip_lon_DMI, 'k','ShowText','on');
caxis([min_pr max_pr]);colormap(cmap);
axesHandles = findobj(get(fig,'Children'), 'flat','Type','axes');
axis(axesHandles,'square')
set(gca,'YTick',);
set(gca,'XTick',);
matlab matlab-figure latitude-longitude
I want to plot lat/lon contours at the south pole, my data consists of grid cells, each with a lat and lon value. My problem is where the longitudes "meets" each other, as you can see in the picture, the vertical longitude in the lower part of the picture have a lot of lines on top of each other.
Does anyone know how to remove them? Here is my code:
coldiv = -57.5:2.5:-7.5;
min_pr = coldiv(1); max_pr = coldiv(end);
cmap = [0 0 0.4; 0 0 0.7; 0 0 1; 0 0.2 1; 0 0.4 1; 0 0.6 1; 0 0.8 1; 0 1 1;
0 1 0; 0.6 0.8 0; 0.6 0.6 0; 0.6 0.4 0; 0.6 0.2 0; 1 0 0];
x = linspace(1,length(coldiv)-2,length(cmap));
xi = 1:length(coldiv)-2;
cmap = interp1(x,cmap,xi);
cmap = [0. 0. 0.; cmap];
fig=figure();
set(fig, 'Position', [10 10 1500 700])
pcolor(mean(tas_ann_DMI_hist_tot,3))
shading flat
hold on;
contour(flip_lat_DMI, 'k','ShowText','on');
contour(flip_lon_DMI, 'k','ShowText','on');
caxis([min_pr max_pr]);colormap(cmap);
axesHandles = findobj(get(fig,'Children'), 'flat','Type','axes');
axis(axesHandles,'square')
set(gca,'YTick',);
set(gca,'XTick',);
matlab matlab-figure latitude-longitude
matlab matlab-figure latitude-longitude
edited Nov 20 at 13:06
asked Nov 20 at 12:58
Nicolaj Hansen
184
184
Could you show what your desired output is?
– Mad Physicist
Nov 20 at 13:10
Ideally I want all the lines that are on top of each other removed. So there are line vertical lines between longitude -150 and 150
– Nicolaj Hansen
Nov 20 at 13:17
2
What about manually drawing meridians withline
orplot
? Drawing contour lines on longitudes is bound to fail where they suddenly drop from 180° to -180°. You may have to label meridians manually, though.
– Brice
Nov 20 at 13:52
1
Can you put a Minimal, Complete, and Verifiable example? Give us some random data for the variables not defined in your code
– Ander Biguri
Nov 20 at 14:43
1
Can't you use thepolaraxes
function ?
– obchardon
Nov 20 at 15:59
|
show 1 more comment
Could you show what your desired output is?
– Mad Physicist
Nov 20 at 13:10
Ideally I want all the lines that are on top of each other removed. So there are line vertical lines between longitude -150 and 150
– Nicolaj Hansen
Nov 20 at 13:17
2
What about manually drawing meridians withline
orplot
? Drawing contour lines on longitudes is bound to fail where they suddenly drop from 180° to -180°. You may have to label meridians manually, though.
– Brice
Nov 20 at 13:52
1
Can you put a Minimal, Complete, and Verifiable example? Give us some random data for the variables not defined in your code
– Ander Biguri
Nov 20 at 14:43
1
Can't you use thepolaraxes
function ?
– obchardon
Nov 20 at 15:59
Could you show what your desired output is?
– Mad Physicist
Nov 20 at 13:10
Could you show what your desired output is?
– Mad Physicist
Nov 20 at 13:10
Ideally I want all the lines that are on top of each other removed. So there are line vertical lines between longitude -150 and 150
– Nicolaj Hansen
Nov 20 at 13:17
Ideally I want all the lines that are on top of each other removed. So there are line vertical lines between longitude -150 and 150
– Nicolaj Hansen
Nov 20 at 13:17
2
2
What about manually drawing meridians with
line
or plot
? Drawing contour lines on longitudes is bound to fail where they suddenly drop from 180° to -180°. You may have to label meridians manually, though.– Brice
Nov 20 at 13:52
What about manually drawing meridians with
line
or plot
? Drawing contour lines on longitudes is bound to fail where they suddenly drop from 180° to -180°. You may have to label meridians manually, though.– Brice
Nov 20 at 13:52
1
1
Can you put a Minimal, Complete, and Verifiable example? Give us some random data for the variables not defined in your code
– Ander Biguri
Nov 20 at 14:43
Can you put a Minimal, Complete, and Verifiable example? Give us some random data for the variables not defined in your code
– Ander Biguri
Nov 20 at 14:43
1
1
Can't you use the
polaraxes
function ?– obchardon
Nov 20 at 15:59
Can't you use the
polaraxes
function ?– obchardon
Nov 20 at 15:59
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
I found a solution.
flip_lon_DMI(flip_lon_DMI<-160) = NaN;
flip_lon_DMI(flip_lon_DMI>190) = NaN;
...
contour(flip_lat_DMI,-90:5:-60,'k--','ShowText','on','Color',[.5 .5 .5]);
contour(flip_lon_DMI,-150:30:180,'k--','ShowText','on','Color',[.5 .5 .5]);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
I found a solution.
flip_lon_DMI(flip_lon_DMI<-160) = NaN;
flip_lon_DMI(flip_lon_DMI>190) = NaN;
...
contour(flip_lat_DMI,-90:5:-60,'k--','ShowText','on','Color',[.5 .5 .5]);
contour(flip_lon_DMI,-150:30:180,'k--','ShowText','on','Color',[.5 .5 .5]);
add a comment |
up vote
0
down vote
accepted
I found a solution.
flip_lon_DMI(flip_lon_DMI<-160) = NaN;
flip_lon_DMI(flip_lon_DMI>190) = NaN;
...
contour(flip_lat_DMI,-90:5:-60,'k--','ShowText','on','Color',[.5 .5 .5]);
contour(flip_lon_DMI,-150:30:180,'k--','ShowText','on','Color',[.5 .5 .5]);
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I found a solution.
flip_lon_DMI(flip_lon_DMI<-160) = NaN;
flip_lon_DMI(flip_lon_DMI>190) = NaN;
...
contour(flip_lat_DMI,-90:5:-60,'k--','ShowText','on','Color',[.5 .5 .5]);
contour(flip_lon_DMI,-150:30:180,'k--','ShowText','on','Color',[.5 .5 .5]);
I found a solution.
flip_lon_DMI(flip_lon_DMI<-160) = NaN;
flip_lon_DMI(flip_lon_DMI>190) = NaN;
...
contour(flip_lat_DMI,-90:5:-60,'k--','ShowText','on','Color',[.5 .5 .5]);
contour(flip_lon_DMI,-150:30:180,'k--','ShowText','on','Color',[.5 .5 .5]);
answered Nov 21 at 8:29
Nicolaj Hansen
184
184
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393536%2ferror-in-longitude-contour-near-the-ploe-matlab%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Could you show what your desired output is?
– Mad Physicist
Nov 20 at 13:10
Ideally I want all the lines that are on top of each other removed. So there are line vertical lines between longitude -150 and 150
– Nicolaj Hansen
Nov 20 at 13:17
2
What about manually drawing meridians with
line
orplot
? Drawing contour lines on longitudes is bound to fail where they suddenly drop from 180° to -180°. You may have to label meridians manually, though.– Brice
Nov 20 at 13:52
1
Can you put a Minimal, Complete, and Verifiable example? Give us some random data for the variables not defined in your code
– Ander Biguri
Nov 20 at 14:43
1
Can't you use the
polaraxes
function ?– obchardon
Nov 20 at 15:59