Bar plot (within a subplot) for unequally spaced X axis points
Show older comments
I have the following code (I am including the plot for subplot (2,2,4)):
subplot(2,2,1);
subplot(2,2,2);
subplot(2,2,3);
subplot(2,2,4);
xIdx = [0.0,21.2,31.5,35.7,44.2,58.3,64.4,82.7,97.0,120.4];
b4 = bar(price_volatility,profit_all,'linewidth',0.1,'FaceColor','flat');
for k=1:size(profit_all,2)
b4(k).CData = k+1;
end
xticks([0.0 21.2 31.5 35.7 44.2 58.3 64.4 82.7 97.0 120.4]);
xticklabels({'0.0','21.2','31.5','35.7','44.2','58.3','64.4','82.7','97.0','120.4'});
xtickangle(45);
ax = gca;
ax.XAxis.FontSize = 8;
legend({'A1','A2'},'fontsize',9);
xlabel('Fig.2(d):X Axis Label','fontsize',12);
ylabel('Y Axis Label','fontsize',12);
I am getting a plot which doesn't look nice due to the unequal spacing on X axis. I would appreciate any suggestion to make it look better.
Accepted Answer
More Answers (0)
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!