Error in longitude contour near the ploe MATLAB
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
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 '18 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 '18 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 '18 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 '18 at 14:43
1
Can't you use thepolaraxes
function ?
– obchardon
Nov 20 '18 at 15:59
|
show 1 more comment
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 '18 at 13:06
asked Nov 20 '18 at 12:58
Nicolaj Hansen
184
184
Could you show what your desired output is?
– Mad Physicist
Nov 20 '18 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 '18 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 '18 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 '18 at 14:43
1
Can't you use thepolaraxes
function ?
– obchardon
Nov 20 '18 at 15:59
|
show 1 more comment
Could you show what your desired output is?
– Mad Physicist
Nov 20 '18 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 '18 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 '18 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 '18 at 14:43
1
Can't you use thepolaraxes
function ?
– obchardon
Nov 20 '18 at 15:59
Could you show what your desired output is?
– Mad Physicist
Nov 20 '18 at 13:10
Could you show what your desired output is?
– Mad Physicist
Nov 20 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 at 14:43
1
1
Can't you use the
polaraxes
function ?– obchardon
Nov 20 '18 at 15:59
Can't you use the
polaraxes
function ?– obchardon
Nov 20 '18 at 15:59
|
show 1 more comment
1 Answer
1
active
oldest
votes
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 |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 |
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 |
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 '18 at 8:29
Nicolaj Hansen
184
184
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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 '18 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 '18 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 '18 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 '18 at 14:43
1
Can't you use the
polaraxes
function ?– obchardon
Nov 20 '18 at 15:59