If you would like to merely add a percentage sign ('%') to your tick labels, without changing the scaling of the labels (ex. 1 ~ 1%, 100 ~ 100%), you can use built-in functions and/or properties of axis objects as of MATLAB R2015b.
If you are using MATLAB R2016b or a later release, you can use the "xtickformat", "ytickformat" and "ztickformat" functions to add '%' signs to your tick labels. Example:
>> plot(1:100)
>> ytickformat('percentage')
Please see the documentation page for "ytickformat" to view the alternative formatting options which are available:
If you are using MATLAB R2015b or R2016a, you can instead use the "TickLabelFormat" property of an axis to add a '%' sign. Example:
>> p = plot(1:100)
>> a = ancestor(p, 'axes')
>> a.YAxis.TickLabelFormat = '%g%%'
Please see the following documentation page for more information about the "TickLabelFormat" property:
If you would like to also change the scaling of your labels, such that 0.1 ~ 10% and 1 ~ 100%, there is currently no built-in function or property to do this. However, the units can be changed by scaling and appending the '%' sign onto the existing labels and applying the changes to the axis property "yticklabel" or "xticklabel". Example:
plot(0:.1:1)
a=[cellstr(num2str(get(gca,'ytick')'*100))];
pct = char(ones(size(a,1),1)*'%');
new_yticks = [char(a),pct];
set(gca,'yticklabel',new_yticks)
Best Answer