Is it possible to obtain both line and bars on the same graph?
1 回表示 (過去 30 日間)
古いコメントを表示
I have these vectors Years, A,B i would like to obtain a single graph with both bar(Years,B) and plot(Years,A).
How can i do this?
Years=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20];
A=[-8.8000 -8.5211 -8.2421 -7.9632 -7.6843 -7.4053 -7.1264 -6.8475 -6.5685 -6.2896 -6.0107 -5.7318 -5.4528 -5.1739 -4.8950 -4.6160 -4.3371 -4.0582 -3.7792 -3.5003 -3.2214];
B=[-8.8000 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189];
%I can obtain separatly graphs:
plot(Years,A);
bar(Years,B);
0 件のコメント
採用された回答
Star Strider
2022 年 6 月 28 日
Years=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20];
A=[-8.8000 -8.5211 -8.2421 -7.9632 -7.6843 -7.4053 -7.1264 -6.8475 -6.5685 -6.2896 -6.0107 -5.7318 -5.4528 -5.1739 -4.8950 -4.6160 -4.3371 -4.0582 -3.7792 -3.5003 -3.2214];
B=[-8.8000 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 1.1589 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189 0.7189];
%I can obtain separatly graphs:
figure
plot(Years,A)
hold on
bar(Years,B)
hold off
.
2 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!