Is there an easy way to redirect the output of gscatter to a previously defined axes handle?

조회 수: 1 (최근 30일)
We are developing a GUI that has a drop box to select the plot type. These different plot types plot in the same figure and axes. We would like to use gscatter from the Statistics Toolbox, but it seems to have no way to redirect its output to a pre-defined figure and axes. Anyone know a way to do this.

답변 (1개)

Razvan
Razvan 2012년 10월 10일
Probably you just need to make the important axes the current axes. For example:
figure
hax1 = subplot(2,1,1);
hax2 = subplot(2,1,2);
load discrim
axes(hax1)
gscatter(ratings(:,1),ratings(:,2),group,'br','xo')
If you use
axes(hax1)
to make hax1 the current axes, then the plot is made in this axes (upper panel). Otherwise it is made in the current axes hax2 (lower panel)...
  댓글 수: 1
Keith Barker
Keith Barker 2012년 10월 21일
This will not work in our situation, and I did try it. The issue is that we have multiple figures that automatically update upon receipt of an event. Some are GUI figures,and to prevent some of the GUI figures from receiving the plots, their handles are hidden. We update the plot figures by directing the output of the plot commands to their respective plot handles (even though they are hidden). Gscatter makes calls to newplot and gca. This only returns figures and axes with visible handles. Since we do not have that, we cannot use gscatter, unless we re-write it and overload the function in our own classes. We may do that, but for now I will look for another way.

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

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by