我想减小条形图图例中样本补丁的大小,使它们是小方块。
x = rand(6,4);
B = bar(x);
BL = legend ((B([1 2 3 4])),{'one','two','three','four'},'fontsize',9);
newPosition = [0.15 0.75 0.15 0.15];
newUnits = 'normalized';
set(BL,'Position', newPosition,'Units', newUnits);
修改
hLegendPatch = findobj(BL, 'type', 'patch');
set(hLegendPatch, 'XData', [.2, .2, .3, .3])