MATLAB Answers

Two Bar Plots on one graph, with the bars next to each other, with horizontal axis showing text

21 views (last 30 days)
I would like to display bar chart, with bars next to each other ... and I want to display units for x-axis as subjects instead of numbers ...


Jan on 28 Jun 2018
What does "next to each other" exactly mean? What are the "units for x-axis"? Do you mean the tick-labels? What are "subjects"? Do you mean strings or char vectors?
Vasishta Bhargava
Vasishta Bhargava on 28 Jun 2018
yeah, tick labels as 'some text' instead of numbers ... and for each tick showing two bars for comparison

Sign in to comment.

Accepted Answer

Jan on 28 Jun 2018
Edited: Jan on 28 Jun 2018
ax = axes;
y = [75 91 105];
bar(y, 1)
ax.XTick = 1:3;
ax.XTickLabels = {'1st', '2nd', '3rd'};


Sign in to comment.

More Answers (0)

Translated by