Removing white space inside MATLAB plot

조회 수: 59 (최근 30일)
Utsav
Utsav 2016년 2월 3일
댓글: Utsav 2016년 4월 29일
I attach my plot and code part for the problem
My code:
% counts: is a 25*25 double array generated in my code
figure(1)
surf(counts,'EdgeColor','none','LineStyle','none');
view(-270,-90);
xtick = [0,2.5,7.5,12.5,17.5,22.5,25];
ytick = [0,2.5,7.5,12.5,17.5,22.5,25];
xticklabels = {'-125','-100','-50' '0','50','100', '125'};
yticklabels = {'-125','-100','-50' '0','50','100', '125'};
set(gca, 'XTick', xtick);
set(gca, 'XTickLabel', xticklabels,'fontsize',12,'fontweight','bold');
set(gca, 'YTick', ytick);
set(gca, 'YTickLabel', yticklabels);
colorbar;
Any help shall be appreciated.

채택된 답변

Mike Garrity
Mike Garrity 2016년 2월 3일
Yet another option is to use this:
axis tight
This tells the rulers on the axes that they shouldn't round out to "nice" numbers.
  댓글 수: 1
Utsav
Utsav 2016년 2월 3일
That worked perfect.....Thanks a trillion Sir Mike Garrity for your magnanimity

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

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 2월 3일
Why are you using surf when you aren't even taking advantage of the 3-D-ish perspective it makes? Why not use image() or imshow() instead?
  댓글 수: 3
Mike Garrity
Mike Garrity 2016년 2월 5일
What version of MATLAB are you using?
That sounds like an issue that was fixed in R2014b. If you're using that version (or later), I'd like some more details.
Utsav
Utsav 2016년 4월 29일
Version 2012a I am using Sir

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

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by