Multiple Scattergram plots in the same figure

조회 수: 1 (최근 30일)
Jerome Coffey
Jerome Coffey 2019년 6월 13일
댓글: Adam Danz 2019년 7월 1일
I would like to create two scattergram plots (Wavelet toolbox) in the same figure. I tried using the subplot command but it did not work (no error message, but only plotted the 2nd figure, not in subplot position).
scattergram(wf,Sgood,'FilterBank',vizLevel); title(good);

채택된 답변

Adam Danz
Adam Danz 2019년 6월 13일
편집: Adam Danz 2019년 6월 19일
The easy way
Create two different figure; then copy the axis of the second figure to the first figure and change the axis positions; then delete the second figure.
% Create first figure
fh(1) = figure();
scattergram(...);
axh(1) = gca;
% Create second figure
fh(2) = figure();
scattergram(...);
axh(2) = gca;
% Change position of 1st axis
axh(1).Position = [.07,.35,.35,.44];
% Copy axis #2 to figure 1
axh(2) = copyobj(axh(2),fh(1));
% Change position of new axis
axh(2).Position = [.55,.35,.35,.44];
% Delete second figure
delete(fh(2))
The hard way
If you look at the function in waveletScattering.m > scattergram(), it has an optional output that is the scattergram. When that output is included, the figure is not drawn. You can use that output to plot the figure in any axis you want but it comes at the cost of doing additional work that is done within the function.
The lines that create the plot are below.
if isVector
plot(AX,tstamps,cfs); grid on;
axis tight;
else
surf(AX,tstamps,F,cfs); view(0,90);
shading interp; axis tight;
end
You'll need to step through that function in debug mode to re-create the tstamps (and F) values. "cfs" is created by including the output to the scattergram function.
csf = scattergram(...);
  댓글 수: 2
Jerome Coffey
Jerome Coffey 2019년 7월 1일
This worked for me but I needed to be in Matlab R2019A... R2017A did not like the syntax of this command:
axh(1) = gca;
Adam Danz
Adam Danz 2019년 7월 1일
Glad it worked!
The gca() command has been around since prior to 2006.
scattergram(), however, joined the club in r2018b so that line was probably the dealbreaker for you in r2017a.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by