Filter löschen
Filter löschen

how to correctly spaced the X and Yticklabel?

2 Ansichten (letzte 30 Tage)
Beatriz Sanchez
Beatriz Sanchez am 7 Sep. 2018
Kommentiert: Image Analyst am 7 Sep. 2018
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 Kommentar
Image Analyst
Image Analyst am 7 Sep. 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by