I am trying to plot scatterplots which have an error-bar each. See code below:
dfs = [0 5 10];
Accuracies = [63.1681 49 56];
SE = [0.0142 0.065 0.04 ]*100;
errorbar(dfs, Accuracies, SE, 'ro');
hold on
plot(dfs,Accuracies,'bo');
title('Accuracies');
hold off;
ylim([40 70])
names = {'Cond1'; 'Cond2'; 'Cond3'};
set(gca,'xtick',[1:3],'xticklabel',names)
However, the x-axis labels are not properly aligned. What is the solution for this situation?
You need to set xtick
s to dfs
. Setting them to [1:3]
keeps only [1 2 3]
and removes the rest.
set(gca, 'xtick', dfs, 'xticklabel', names);
xlim([-1 11]); %just for better visualisation