필터 지우기
필터 지우기

How to make stack plot with y axis consisting of multiple plots?

조회 수: 35 (최근 30일)
Jay Vaidya
Jay Vaidya 2020년 11월 18일
댓글: Jay Vaidya 2020년 11월 20일
I make the plots by the following code using subplots
subplot(2,1,1)
for i=2:size(data,1)
plot_fig(i) = plot(data(1,:),data(i,:),'LineWidth',2.5);
hold on
end
subplot(2,1,2)
plot_fig = plot(data(1,:),y_2(2,:),'LineWidth',2.5);
But I was wondering if can do the same but using stackedplot() considering that my top plot will have multiple plots in it.
The x-axis is same for the above 2 plots. That means these plots can be a stacked plot.
  댓글 수: 9
Jay Vaidya
Jay Vaidya 2020년 11월 19일
Yes, that is right, I am looking for that but with a functionality such that when I zoom in to one of the plots then other plot also shows zoomed in plot (because their plotted x-axis is still the same data)
Adam Danz
Adam Danz 2020년 11월 19일
I think Vasishta Bhargava's answer is what you're looking for.
Also, I just uploaded a function to the file exchange, stackedaxes() which mimicks Matlab's stackedplot but returns the axis handles and allows you to access or add to the content of the figure.

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

채택된 답변

VBBV
VBBV 2020년 11월 19일
tbl = readtable('stacked.xlsx');
Vars = {{'A','B','C','D','E'},'F'}; % assuming 6 variable names(Var1 ...Var6) as A,B... E, Five of them plotted as one and remaing seperately
stackedplot(tbl,Vars)
  댓글 수: 11
Jay Vaidya
Jay Vaidya 2020년 11월 20일
Hello Vasishta,
Can I not give individual titles to the 2 plot windows in the stackedplot? I am using s.title = 'plot1' in general.

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by