MATLAB Answers

0

In 2016b is there a way to get categories on the x-axis of a bar chart?

Asked by Daniel Gray on 28 Jun 2017
Latest activity Answered by Mishaal Aleem on 28 Jun 2017
I have seen how to do it on the 2017 release, but wondered if there was a way to get categories on the x-axis of a bar chart as opposed to just numbers on the 2016b release?

  0 Comments

Sign in to comment.

1 Answer

Answer by Mishaal Aleem on 28 Jun 2017
 Accepted Answer

In R2016b, you can use 'xticklabels'. Please see the xticklabels documentation for more details.
Here is a simple example applied to a bar chart.
x = [1,2,3,4,5];
y = [3,5,6,7,2];
bar(x,y);
labels = {'A', 'B', 'C', 'D', 'E'}; % Labels to use on x-axis
xticklabels(labels);

  0 Comments

Sign in to comment.