MATLAB: 2D Plotting With Non Numeric X Axis

2d plots

I want to plot 2 dimensional data lets say monthly income. My problem is the values of the x axis which are non numeric. On the y axis I want income and along the x axis months expressed as Jan, Feb, …. Lets assume I read the data from an ordinary textfile where each row contains month and income. How do I get the plot that I want?

Best Answer

Plot y as usual with a bar() or plot() function call, then change the numerical labels from 1 - 12 to months:
set(gca,'XTickLabel',{'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'})
Related Question