Evenly distribute strings on axis ticks
Show older comments
Hey everyone,
I want to make a graph and replace the 'xticklabel' by an array of strings.
y = rand(20,1); %fake data
bar(y);
XLabelStrings = {'T1', 'T2', 'T3', 'T4', 'T5', 'T6'};
set(gca, 'xticklabel', XLabelStrings, 'xtick', 1:length(XLabelStrings));
I would like to spread the strings evenly over the x axis. However, this array of string doesn't have the same number of values than the number of data points on the graph and i can't seem to find a way to fix this problem.
I have looked around but couldn't find an answer to this particular case.
Thank you for your help!
Accepted Answer
More Answers (0)
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!