how to correctly spaced the X and Yticklabel?

1 次查看(过去 30 天)
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