I am trying to Combine a Line and a Bar Chart using Two y-Axes.

조회 수: 3 (최근 30일)
sara mollamohammada
sara mollamohammada 2019년 5월 25일
댓글: sara mollamohammada 2019년 5월 26일
I am trying to combine a Line and a Bar Chart using two y-axes. I am using the following code and the line chart get hidden behind the bar graph.
C1=[0.26;0.35;0.27];
C2=[21;29;27];
set(gca,'XTickLabel',{'0.08 g ','0.2 g ','0.40 g '},'FontWeight','bold')
yyaxis left
p = plot(C1);
ylim([0 0.4])
yyaxis right
b=bar(C2);
ylim([0 30])
Can someone help me solve this problem?

채택된 답변

dpb
dpb 2019년 5월 26일
...
yyaxis right
hB=bar(C2,'FaceAlpha',0.80);
...
Salt to suit...

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by