Bar plot using multiple table variables?

조회 수: 95 (최근 30일)
Jeffrey Marak
Jeffrey Marak 2019년 5월 28일
답변: Prasanth Sikakollu 2019년 6월 18일
I have a table as attached image. how do I plot First column on X and Varname2, Varname3 and Varname4 on Y axis together on the same plot?? I tried hold on function but the previous plots just get replaced.
  댓글 수: 2
Utkarsh Belwal
Utkarsh Belwal 2019년 6월 11일
Can you attach the table file also
Jeffrey Marak
Jeffrey Marak 2019년 6월 18일
mat.PNG
Utkarsh Belwal Hi, im attaching table here

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

답변 (2개)

Prasanth Sikakollu
Prasanth Sikakollu 2019년 6월 18일
Hi,
You can try the following code. Assuming that the data is present in the table named "table_data".
% table_data has the data in the form of a table.
bar(categorical(table_data{1:7, 1}), table_data{1:7, 2:4});
legend(table_data.Properties.VariableNames(2:4));
xlabel('LandUse Types');
Its outcome is the following bar graph.
For more information on Bar charts, refer to the following documentation link.
Hope it helps

Peter Perkins
Peter Perkins 2019년 6월 12일
It's not completely clear what you are asking for, but my guess is that you want bar, with the 'stacked' input, and t{2:7,2:4} as your (one) input. Then label the bars with t.LandUse. And maybe use t{1,2:4} in some kind of legend?
  댓글 수: 1
Jeffrey Marak
Jeffrey Marak 2019년 6월 18일
matlab.png
I want to plot like the image attached

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by