matlab - Putting space between bars using bar function -


i try plot 16 bars, 8 of these belong 1 group. want give group red color, other 8 belong group given blue color. arrange bar in pairs, each pair containing 1 red group , 1 green group. have tried following:

bar(num1,info(1:2:end); bar(num2, info(2:2:end); 

in info contains 16 values want plot, num1=1:2:numel(info) , num2=2:2:numel(info). if way, bars placed adjacent neighbors , there no gaps between bars. ideally, improve visualization, there should space in between pairs no space within pair. instance, bar1bar2 <space> bar3bar4 <space> bar5bar6<space>...

could me spacing issue? thank much!

see docs bar. can reshape info 2xn (instead of current shape 1x2n) , use single bar command plot 2 series, , take care of spacing.

see image docs: enter image description here

if want keep doing way, tweak num1 , num2:

n = numel(info) / 2; num1 = (1:n) * 3; num2 = (1:n) * 3 + 1; 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -