Since Matlab 2015 , I am unable to get or infer the x position of each bar.
which is false (the bare are slightly offset from 1 and 2)
Other Matlab Answers suggest using
However, this attribute is undocumented and hidden from the user, making it risky and unorthodox. Further, while "hbar(1).xOffset" returns a non-zero number when executed in the command window, it produces "0" within any script.