PLease help me to understand tight subplot fuction

조회 수: 20 (최근 30일)
Shahrin Islam
Shahrin Islam 2018년 7월 28일
댓글: Shahrin Islam 2018년 7월 28일
[ha, pos] = tight_subplot(3,2,[.01 .03],[.1 .01],[.01 .01]) for ii = 1:6; axes(ha(ii)); plot(randn(10,ii)); end set(ha(1:4),'XTickLabel',''); set(ha,'YTickLabel','')
Hello. I am a new learner. I need to concise my subplot. Please help me with my code attached following. I don't understand how can I use the above function with my code. Please help me.
% Display the original Image image = imread('boardday.jpg'); % Read Colour Image and convert it to a grey level Image myimage = rgb2gray(image); figure; subplot(2,1,1); imshow(image); title ({'Original';' Image'}); subplot(2,1,2); imshow(myimage);title({'Gray Scale';'Image'});

채택된 답변

jonas
jonas 2018년 7월 28일
편집: jonas 2018년 7월 28일
First, type
help tight_subplot
Then, when you understand the syntax: create the axes using the function and change subplot(...,ax) to axes(ha(ax)), where ax is the subplot you want to make the current axes
  댓글 수: 3
jonas
jonas 2018년 7월 28일
편집: jonas 2018년 7월 28일
I understand. The most important thing you can learn as a beginner is to find information on your own, as you are likely to encounter many new functions. Nevertheless, here is something that works for your code:
[ha, pos] = tight_subplot(2,1,[.01 .03],[.1 .01],[.01 .01])
image = imread('peppers.png'); % Read Colour Image and convert it to a grey level Image
myimage = rgb2gray(image);
axes(ha(1))
imshow(image);
title ({'Original';' Image'});
axes(ha(2))
imshow(myimage);
title({'Gray Scale';'Image'});
set(ha,'visible','off')
Shahrin Islam
Shahrin Islam 2018년 7월 28일
Thank you so much for the help. It gave my desired results. Actually I have been working on this for last 2 days but could not solve it. Next time I will work harder. Thanks again.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by