How can I change the thickness of a bar within the legend of a plot in MATLAB 7.5 (R2007b)?

3 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
The thickness of a bar inside a legend can be changed by modifying the patch object itself. This can be accomplished as follows:
1. Create a BAR plot with a legend:
a=rand(1,100);
bar(a);
l=legend('foo');
2. Obtain and modify the 'xData' and 'yData' property of the legend patch object:
h=findobj(l,'type','patch');
set(h,'ydata',[0.,0.5,0.5,0.3,0.3],'xdata',[0.2,0.2,0.4,0.4,0.2]);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

标签

产品


版本

R2007b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by