matlab绘图时如何使图例变小_在Matlab图例中更改填充样本的大小

在Matlab中创建包含线条和填充的图表时,可以使用`findobj`和`set`函数来改变图例中线条样本的长度,但这种方法不适用于填充。为改变图例中填充样本的大小,可以通过查找图例内的patch对象并设置其`XData`属性。另外,可以通过调整图例的`Position`属性或`FontSize`来改变图例整体的大小。
摘要由CSDN通过智能技术生成

I'm creating a plot in matlab that includes some lines, as well as a fill. For example,

fill([0 1 1], [0 1 0], [.9 .9 .9]);

plot(rand(5, 1), 'b');

plot(rand(5, 1), 'r');

plot(rand(5, 1), 'g');

legend('fill', 'line one', 'line two', 'line three');

I can change the length of the sample lines in the legend with:

f = findobj('type', 'line');

set(f(2), 'XData', [.2, .3]); % Changes line three

set(f(4), 'XData', [.2, .3]); % Changes line two

set(f(6), 'XData', [.2, .3]); % Changes line one

But this method doesn't seem to work for the fill. How do I change the size of the fill sample in the legend?

解决方案fill([0 1 1], [0 1 0], [.9 .9 .9]); hold on

plot(rand(5, 1), 'b');

plot(ra

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值