Click on Subplot and Open it in a "New" Figure

조회 수: 41 (최근 30일)
John F
John F 2012년 7월 10일
Hi everyone!
I've set up my code to plot four subplots into one figure. I'm using this array of subplots as an overview of my signal data to do a quick check of what's going on in the signal.
However, after plotting these four axes into one figure, I'd like to be able to click on one of the subplots in "Figure 1" and have that subplot open in its own "Figure 2" in which I could do more detailed plotting work.
Any help?
Thanks!
JF

답변 (2개)

Doug Hull
Doug Hull 2012년 7월 10일
You could set the parent property of the axes to a new figure.
  댓글 수: 1
John F
John F 2012년 7월 10일
These answers are great (and so are your videos Doug! As a new user, I'm a big fan!) but the problem I'm having is trying to interact with the Plot GUI.
Rather than setting parent properties in the command window, I'm looking to be able to click on a subplot (say in the lower right quadrant of Figure 1), and have a new figure (Figure 2) pop up with just the subplot that was in the lower right quadrant of Figure 1.
Is this possible? Or would I have to create my own separate GUI to do this? (the more I think about it...this is seeming more like what I'd need to do.)

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


Luffy
Luffy 2012년 7월 10일
One way of doing this is:
Example:
h = figure;
income = [3.2,4.1,5.0,5.6];
outgo = [2.5,4.0,3.35,4.9];
subplot(2,1,1); plot(income)
title('Income')
subplot(2,1,2); plot(outgo)
title('Outgo')
g = figure; % g is new figure where subplot is to be presnt
copyobj(get(h,'Children'),g);
% Now if you want subplot(2,1,1) delete other subplots(in ur case u hv to delete 3 other subplots which u don't want)
% In this example i delete subplot(2,1,2)
delete(subplot(2,1,2));
  댓글 수: 2
Ilham Hardy
Ilham Hardy 2012년 7월 10일
편집: Ilham Hardy 2012년 7월 10일
How do you know which figure (subplot) was clicked?
Luffy
Luffy 2012년 7월 10일
편집: Luffy 2012년 7월 10일
I dunno how to identify subplot clicked but user can create a popup menu to select which subplot to re plot in a new figure & based on that use value property to delete other subplots.

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

카테고리

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