MATLAB: Is it possible to change label names in Matlab

axisfigurefprintfgraphprint

I want to have different names in my Y axis rather than numbering like the following photo:

Best Answer

Here I'll do a barh(A) where A is not sorted, and I'll label the different groups based on the longest bar. Then sort according to the size of the first column in A while preserving the group label association. I adjusted the values in your A a little bit to make it more clear:
A = [2,6,50;3,4,90;1,6,103];
longbar = {'shortest','middle','longest'};
subplot(211)
barh(A)
set(gca,'ytick',1:3,'yticklabel',longbar)
title 'unsorted data:'
box off
% Resize based on first column:
[values, order] = sort(A(:,1));
sortedmatrix = A(order,:)
subplot(212)
barh(sortedmatrix)
set(gca,'ytick',1:3,'yticklabel',longbar(order))
title 'sorted data:'
box off