Label x-axes by fraction
Show older comments
I am trying to graph a simple plot. The y-axis should be a vector of 19*1 with different values. My x-axis should be the numbers from 1/20 to 1/2 in ascending order. I would like to lable them as '1/2', '1/3'...'1/20'. How can I do that? I used the code
ax=gca
ax.XTick=[flip(1./(2:20))]
ax.XTickLabel={'1/2','1/3','1/4','1/5','1/6','1/7','1/8','1/9','1/10','1/11','1/12','1/13',...;
'1/14','1/15','1/16','1/17','1/18','1/19','1/20'}
plot(ax.XTick,FE(:,5)) or plot(ax.XTickLabel,FE(:,5))
I do not know how to plot using the ax.XTick,ax.XTickLabel and my 19*1 vector that is in my workspace. Any help will be appreciated.
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!