Question

I am using the following piece of code to make a subplot of n cases. I added three to make it easily readable

for c=1:cols
 subplot(n,cols/n,c)
 labels_x = 1:cols;
 labels_y = 0:max_value;
 data = count_pairs(c,:);
 bar(data,0.2,'grouped','b');
 set(gca,'XTick',labels_x)
 set(gca,'YTick',labels_y)
 xlabel('β')
 title_value = sprintf('Frequencies of %d,β',c);       
 title(title_value);
 hold all;
end

The problem is that I am not getting the same maximum value (which is the max_value variable) on the Y axis and so the graph cannot be interpreted very easily.Plus I am losing a lot of space since β goes up to 10 (lots of white space next to the final bar), even if cols variable equals to 10. Even if I change the 0.2 value, white space does not get any les. Any ideas?

Thanks in advance!

Was it helpful?

Solution

Use ylim and xlim:

ylim([0 max_value])
xlim([0 cols])

This should solve your problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top