Subplots of subplots (maybe using subaxis)

조회 수: 13 (최근 30일)
Sim
Sim 2022년 5월 11일
댓글: Sim 2022년 8월 17일
I am using the beast exchange file, which default example,
load('Nile.mat') % annual streamflow of the Nile River startin from year 1871
out = beast(Nile,'start', 1871); % trend and seasonality of the time-series
H = plotbeast(out)
produces the following subplots:
H =
1×8 Axes array:
Axes Axes Axes Axes Axes Axes Axes Axes
Now, I would like to create subplots of those subplots, produced by beast, possibly using the subaxis function (but I am open to other tools for subplots!). Unfortunately, the following attempt does not work:
load('Nile.mat')
out = beast(Nile,'start', 1871);
% subplot of subplots?
for i = 1 : 6
subax(i) = subaxis(4,2,i);
H = plotbeast(out)
end
My goal would be to get something like this:
How can I get it ? Do you have any suggestion / idea?
  댓글 수: 4
Kaiguang
Kaiguang 2022년 8월 16일
Shown above are some examples to plot the results from the beast outputs. If more help is needed, contact me at zhao.1423@osu.edu.
Sim
Sim 2022년 8월 17일
thanks a lot @Kaiguang, very kind!!!

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

채택된 답변

Kaiguang
Kaiguang 2022년 8월 17일
Repost my code snippet here to explain the beast output:
%install the beast program
eval(webread('http://b.link/beast',weboptions('cert','')))
% load a sample time series
load('Nile.mat')
% For this example, make sure not to fit the seasonality bcz it is an
% annual trend-only streamflow time series, without any periodic component
o=beast(Nile,'season','none');
% o is a struct variable containing all the results
o
% Plot the results directly from o
clf
subplot(3,1,1)
plot(o.time, o.data) % plot the original data
subplot(3,1,2)
plot(o.time, o.trend.Y) % plot the fittted trend
subplot(3,1,3)
plot(o.time, o.trend.cpOccPr) % plot the changepoint occurance probability
% if needed, check this pdf https://cran.r-project.org/web/packages/Rbeast/Rbeast.pdf
% starting from Page 7 to see more details about the output fields
%Alternatively, use the plotbeast to choose the subplots through the 'vars'
%argument
plotbeast(o,'vars',["t","tcp","torder"])
plotbeast(o,'vars',["t","tcp","torder","error"])
plotbeast(o,'vars',["t","error"])

추가 답변 (1개)

the cyclist
the cyclist 2022년 5월 12일
I would try the native tiledlayout function to make the subplots. I've never used beast, so I'm not sure if there are any weird incompatibilities.
  댓글 수: 1
Sim
Sim 2022년 5월 12일
thanks @the cyclist :) But, unfortunately, it does not work...
load('Nile.mat')
out = beast(Nile,'start', 1871);
tiledlayout(2,1);
% Tile 1
nexttile
plotbeast(out)
% Tile 2
nexttile
plotbeast(out)

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

카테고리

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