gpt4 book ai didi

matlab - 更改图形图例中的符号大小

转载 作者:太空宇宙 更新时间:2023-11-03 20:11:01 25 4
gpt4 key购买 nike

是否可以选择更改 Matlab 创建的图例中的符号大小?我只想增加图例中的符号大小。我使用了 4 个散点,每个 3 个点。

最佳答案

Matlab R2014b 或更新版本 ( HG2 )

图例中元素的组织现在不同了。以下作品:

plot(1:10, 'o-'); 
hold on
plot(5:12, 'r*--'); %// example plots
[~, objh] = legend({'one plot', 'another plot'}, 'location', 'NorthWest', 'Fontsize', 14);
%// set font size as desired
objhl = findobj(objh, 'type', 'line'); %// objects of legend of type line
set(objhl, 'Markersize', 12); %// set marker size as desired

enter image description here

Matlab R2014a 或更早版本

增加字体大小:获取所有'text' 类型的图例子项的句柄,并将它们的'Fontsize' 属性设置为期望值。

增加标记大小:获取所有'line' 类型的图例子项的句柄,并将它们的'Markersize' 属性设置为期望值。

plot(1:10, 'o-'); 
hold on
plot(5:12, 'r*--'); %// example plots
h = legend('one plot', 'another plot', 'location', 'NorthWest'); %// example legend
ch = findobj(get(h,'children'), 'type', 'text'); %// children of legend of type text
set(ch, 'Fontsize', 14); %// set value as desired
ch = findobj(get(h,'children'), 'type', 'line'); %// children of legend of type line
set(ch, 'Markersize', 12); %// set value as desired

enter image description here

关于matlab - 更改图形图例中的符号大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28741747/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com