Subplots within a GUI figure
이전 댓글 표시
I am developing a GUI using GUIDE. I have three axes defined in GUI. two of them I filled with two plots. The third axes, however, I would like to divide into several subplots. The problem is everytime I try to use it the subplot is dividing the entire GUI figure into several plots which is not what I wanted. Basically I have Axes1 which I filled with a figure, and Axes2 which I filled with another figure. and Now I have Axes3 which i like to divide into say 2x2 subplots. How do I do it?
댓글 수: 7
John Chilleri
2017년 2월 10일
Haven't considered this before, but without looking into it, you could always just construct your fig with four plots in that area, which should essentially have the same effect (there's probably a better way though).
Pappu Murthy
2017년 2월 10일
John Chilleri
2017년 2월 10일
편집: John Chilleri
2017년 2월 10일
Pappu Murthy
2017년 2월 11일
John Chilleri
2017년 2월 11일
Pappu Murthy
2017년 2월 11일
Pappu Murthy
2017년 3월 4일
답변 (2개)
Image Analyst
2017년 2월 11일
Pappu, is this what you mean:
% Plot top plot.
subplot(2, 2, 1);
plot(1:10, 'bo-');
title('subplot(2, 2, 1)');
% Plot middle plot.
subplot(2, 2, 2);
plot(sind(1:80), 'rd-');
title('subplot(2, 2, 2)');
% Plot 4 more plots in the bottom left spot
subplot(4, 4, 9);
scatter(rand(1,40), rand(1,40));
title('subplot(4, 4, 9)');
subplot(4, 4, 10);
plot(exp(1:10)/30000, 'ko-');
title('subplot(4, 4, 10)');
subplot(4, 4, 13);
plot(exp(rand(1,10)), 'co-');
title('subplot(4, 4, 13)');
subplot(4, 4, 14);
plot(exp(1:-.1:0), 'go-');
title('subplot(4, 4, 14)');

댓글 수: 4
Pappu Murthy
2017년 2월 11일
Image Analyst
2017년 2월 11일
Then mock up a screenshot of what you do want, because no one knows.
Pappu Murthy
2017년 2월 11일
Pappu Murthy
2017년 2월 11일
Image Analyst
2017년 2월 11일
You need to put two panels on your GUI. One will contain the single large axes, and the other will contain the 4 small axes. Then you just set the visible property to 'on' or 'off' to show whichever you want
% Show 4 axes
handles.panelFour.Visible = 'on'; % Show 4 axes.
handles.panelOne.Visible = 'off'; % Hide large axes.
% Show single large axes
handles.panelFour.Visible = 'off'; % Hide 4 axes.
handles.panelOne.Visible = 'on'; % Show large axes.
댓글 수: 4
Pappu Murthy
2017년 2월 12일
Image Analyst
2017년 2월 12일
Did you try my panels method? It should, and would if you'd just try it.
Or did you try to use
cla reset;
before plotting to get rid of remnants? Or, if you like doing things the hardest way, just delete the handles to the existing plots and create 4 brand new ones.
Pappu Murthy
2017년 2월 13일
Image Analyst
2017년 2월 13일
I did not reference any variable or control called "mypicture". You use GUIDE and put two panels on it. I called them panelFour and panelOne but you can call them whatever you want. Reference them with the names that you actually used.
In one panel, place one axes. In the other panel, place 4 axes.
Then just set the visibility property of the two panels to show one and hide the other.
카테고리
도움말 센터 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
