# Bar plot in Matlab with specified values on the x-axis

• MATLAB
In the plot below
Code:
x=.1:.01:.2;
y=5:15;
bar(x,y)
I like all the values of x to be displayed on the x-axis. For example by plotting this bar, the values of x=0.11,0.13, 0.15, 0.17, 0.19 are not displayed on the x-axis. I appreciate any help.

DrClaude
Mentor
In the plot window, you can select Edit -> Axes Properties... There you can set where tics appear.

kreil
Gold Member
http://www.mathworks.com/help/matlab/ref/axes-properties.html?searchHighlight=xtick

x=.1:.01:.2;
y=5:15;
bar(x,y)

After plotting, you can create a handle to the axes object (gca stands for, "get current axes") and then change the XTick property to whatever you'd like, such as your original x values:
ax = gca;
ax.XTick = x;

Note: this assumes you're using R2014b+. For older releases you use the get/set functions to fetch or change properties of the axes.