필터 지우기
필터 지우기

how to correctly spaced the X and Yticklabel?

조회 수: 2 (최근 30일)
Beatriz Sanchez
Beatriz Sanchez 2018년 9월 7일
댓글: Image Analyst 2018년 9월 7일
Hi, this is my code:
vec=[-180 -36 0 36 180]
for i=1:3
figure(1)
subplot(1,3,i)
if i==1
contourf(vec,vec,nzro_mean1)
elseif i==2
contourf(vec,vec,nzro_mean2)
elseif i==3
contourf(vec,vec,nzro_mean3)
end
axis square
xt=get(gca, 'Xtick');
xtv=linspace(min(xt), max(xt), numel(vec));
yt=get(gca, 'Ytick')
ytv=linspace(min(yt), max(yt), numel(vec));
set(gca, 'XTick',xtv, 'XTicklabel',{vec}, 'YTick',ytv, 'YTicklabel', {vec})
axis equal
title(['Especie ',num2str(i)])
colorbar('southoutside')
end
but the Xticklabels are spaced differently than Yticklabel, I don't understand, everything I tried just make it worse or the same... Xticklabel is wrongly spaced and the farest I came is to get Yticklabel as wrong as Xticklabel.
  댓글 수: 1
Image Analyst
Image Analyst 2018년 9월 7일
Your code doesn't run. What is nzro_mean1, etc.? And you forgot to include a screenshot so we don't know what you're talking about. Please do so and indicate which spaces or spacings or separations of what from what you're talking about. In the meantime, check out the functions xticks(), yticks(), and axis() and their input parameters.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by