xticks showing latitude and longitude

I have 3-dim atmospheric data of which I want to plot a vertical cross section. Getting the cross section data and plotting it is no problem, just the ticks give me headache. I want the x-axis to show me the location with both latitude and longitude, preferably longitude below the latitude. How can I customize the xticks so that they exactly show that?

 채택된 답변

Iain
Iain 2013년 5월 30일

0 개 추천

set(axis_handle,'YTickLabel',{label1,label2...})
Coming up with the labels is up to you.

댓글 수: 3

peter
peter 2013년 6월 5일
Thanks. In principle that works. However, if I want the longitudes for the ticks below the values for latitude, how to do that?
Iain
Iain 2013년 6월 5일
I'm not sure theres a latex character for new line - if there is, make sure it is part of the label. If not, try carriage return and linefeed (char(13) and char(10) respectively).
peter
peter 2013년 6월 5일
I tried char(10) and char(13), no luck. Acc. to help pages, tick labels do not interpret TeX sequences.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

José-Luis
José-Luis 2013년 5월 30일
편집: José-Luis 2013년 5월 30일

0 개 추천

aH = axes;
h = plot(aH,rand(10,1));
set(aH,'XTick',1:2:10);
set(aH,'XTickLabel',[]);
oneTick = ['Lookee up' char(10) 'Lookee down']; %char(10) is return of carriage
your_labels = cell(1,5);
y_lim = get(aH,'YLim');
y_offset = y_lim(1) - diff(y_lim)/15; %This is the tricky bit, to get it looking right you have to set a good offset
your_labels(:) = {oneTick}; %you could place your labels in a cell array
counter = 1;
for ii = get(aH,'XTick')
text(ii,y_offset,your_labels{counter},...
'HorizontalAlignment','center',...
'Interpreter','latex');
counter = counter + 1;
end
Please accept an answer if it helps you.

댓글 수: 1

peter
peter 2013년 6월 5일
Thanks! It seems that one can only accept one answer, even though both have been helpful. And this one even does the trick with the linebreak.

댓글을 달려면 로그인하십시오.

카테고리

질문:

2013년 5월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by