How to draw a bar plot with different colors and several groups

조회 수: 1 (최근 30일)
Itzik Ben Shabat
Itzik Ben Shabat 2017년 8월 31일
댓글: Itzik Ben Shabat 2017년 8월 31일
I want to plot a bar graph which summarizes algorithms performance has three main parameters 1. Publication year (the x axis) 2. Data type (bar color) 3. Algorithm score ( bar height)
Here is an example data:
dtypes = {'type1','type2','type3'}; %All of the possible data types
methods_name = {'method1','method2','method3'};
methods_accuracy = [89.2, 95.54, 85];
methods_year = [2016, 2017, 2016] ;
methods_dtype = {'type1', 'type2', 'type2'};
Here I wish to get 3 bars, 2 of which in the year 2016 with different colors and one in 2017 with a color matching to one from 2016.
For some reason, I can't seem to do what I want using the
bar
function. It seems simple but I think I am missing something regarding to how this function works.

답변 (1개)

KL
KL 2017년 8월 31일
  댓글 수: 1
Itzik Ben Shabat
Itzik Ben Shabat 2017년 8월 31일
I saw this one. In their data, each example has its own class. So this would hav worked for me if each paper was in a different year. But in my case there may be several methods in the same year.

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by