필터 지우기
필터 지우기

optimal data structure stacked bar plot

조회 수: 2 (최근 30일)
VMat
VMat 2016년 9월 20일
댓글: VMat 2016년 9월 20일
Hello. I wish to plot a bar chart, with the following constraints:
  • x axis contains 6 values (strings)
  • y axis records the time
  • each bar shall contains in a stacked way 5 different run time, associated with the corresponding value on the x axis (i.e. the same algorithm runs 5 times for each of the values in x, timer is set through tic/toc)
  • given the i-th run (which corresponds to the i-th slot on each bar), it is coloured the same across the six bars
  • different runs are given different colours (i.e. five colours in total)
I am not familiar with matlab map objects nor multi dim arrays: I am having troubles displaying the stacked bars, could you please help on what would be the optimal way to represent data in this common case? Basically, if considering a matrix form to store the runs time, each bar in the plot would be one column of a 5 X 6 matrix.
Many thanks for any hint.

답변 (1개)

Alan Weiss
Alan Weiss 2016년 9월 20일
Sounds like you want a stacked bar graph.
You also want the x-axis to have strings. Try this:
ax = gca;
ax.XTick = 1:6;
ax.XTickLabel = {'Low','Lowish','Medium','Highish','High','Super'};
Good luck,
  댓글 수: 1
VMat
VMat 2016년 9월 20일
Thanks Alan.
I am not new to these information you point out, thanks again.
My question concerns rather how to best handle the data structure behind the stacked bar graph, with the constraints indicated above.
Any hint about is still very welcome, thank you.

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

카테고리

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