Something like this?
X = categorical({'Small','Medium','Large','Extra Large'});
X = reordercats(X,{'Small','Medium','Large','Extra Large'});
Y = [10 21 33 52];
ylabel('y-axis','FontSize',12)
xlabel('x-axis','FontSize',12)
title('Comparing Y and X over intervals','FontSize',16);
% threshold value
threshold = 30;
% plot bar one by one
figure(1)
hold on
for ii = 1:1:length(X)
b = bar(X(ii), Y(ii));
if (Y(ii) >= threshold)
set(b, 'FaceColor', 'r');
else
set(b, 'FaceColor', 'b');
end
end