How to make stack plot with y axis consisting of multiple plots?
39 ビュー (過去 30 日間)
古いコメントを表示
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);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/417678/image.jpeg)
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 件のコメント
Adam Danz
2020 年 11 月 19 日
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/419203/image.gif)
採用された回答
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/419083/image.png)
11 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!