Subplot in GUI

I want to compare two graph in MATLAB's GUI. Can I use only one axes with subplot condition? ^_^

답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 5월 24일

0 개 추천

No. Use two axes and write to them each as you would with a subplot. Basically make your own subplots with a number of axes.

댓글 수: 3

ken kin
ken kin 2011년 5월 24일
I see.. There was an error when i try it.
I thought there is a special syntax to make it work.
Ok. I'll try it.
Thanks, sean.
Sean de Wolski
Sean de Wolski 2011년 5월 24일
doc axes
To see how to grab the handle to the one you want and plot to it.
ken kin
ken kin 2011년 5월 24일
Nice. it's work.
Thanks. ^_^ .

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

Walter Roberson
Walter Roberson 2011년 5월 24일

0 개 추천

You can use a single axes and supply position coordinates for the images if you are using image() or imagesc(). See the documentation for the x,y parameters here (they do not work exactly as one would expect so please read the documentation.)

댓글 수: 2

ken kin
ken kin 2011년 5월 24일
I used the usual plot function to make the graph.
Can it work with the same way with image's function?
I think the parameters is different ...
Walter Roberson
Walter Roberson 2011년 5월 24일
It can be done, but you might find using multiple axes to be easier.
It would look somewhat like this:
numtick = 5;
plot(x1,y1);
hold on
xL = get(gca,'XLim');
xoffset = xL(2) + (xL(2) - xL(1)) / 10;
plot(x2+xoffset,y2);
nxL = get(gca,'XLim');
minx2 = min(x2);
nxL(1) = minx2 + xoffset;
x1tickpos = linspace(xL(1),xL(2),numtick);
x2tickpos = linspace(nxL(1),nXL(2),numtick);
x1ticklab = cellstr(num2str(x1tickpos(:)));
x2ticklab = cellstr(num2str(x2tickpos(:)-xmargin));
set(gca, 'XTick', [x1tickpos,x2tickpos], 'XTickLabel', vertcat(x1ticklab,x2ticklab))

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2011년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by