필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Create Bar Charts with different bar colours with a legend

조회 수: 1 (최근 30일)
BdS
BdS 2020년 3월 27일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I would like to create a bar chart (not stacked) with different colour for each bar. But it should also include a legend (in the top right of the bar chart) with the names for each coloured bar (=the variable names). Thank you for your help.
% here is my code
for f=1:nBEKBFonds
figure(f)
pInd=transpose(peersInd==f);
% choose corresponding funds for each strategie
Var1=TotRetBEKB(1,f);
Var2=TotRetPeers(1,pInd);
VarPlot=[Var1,Var2];
% plot
bar(VarPlot);
grid on
.
.
end

답변 (1개)

Cris LaPierre
Cris LaPierre 2020년 3월 28일
This is a popular assignment today. See this post.
As for the legend, it's pretty simple. Take a look at this doc page for how to do it.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by