MATLAB: How to change space between bars in a bar graph and the y-axis/edges of the graph

bar graphgraphplot

I'm trying to change the distance between the bars of my graph and the vertical edges of the graph so there is little to no space (the bars touch the y-axis). How can I do this? My current code is:
data = [1, 2, 3; 1, 2, 3; 1, 2, 3];
labels = ["a", "b", "c"];
graph = bar(pubs,'stacked');
ylabel("Number of Publications");
xticks(1:length(data));
xticklabels(labels);
xtickangle(45);
set(gcf, 'Position', [0,0,1000,400]);

Best Answer

data = [1, 2, 3; 1, 2, 3; 1, 2, 3];
labels = ["a", "b", "c"];
graph = bar(data,'stacked');
ylabel("Number of Publications");
xticks(1:length(data));
xticklabels(labels);
xtickangle(45);
set(gcf, 'Position', [0,0,1000,400]);
axis tight % <==== add this line
Related Question