Change legend line style

给你一囗甜甜゛ 提交于 2019-12-01 12:06:55

You could play with the outputs arguments of legend, especially the icons variable (check here).

According to the docs, they correspond to

Objects used to create the legend icons and descriptions, returned as text, patch, and line object.

Therefore you might use something like this to modify the LineWidth property of any of your plot, or both of course:

clear
clc
close all
x = 1:10;

plot(x,rand(1,10));
hold on;

plot(x,x,'k');

[h,icons,plots,str] = legend('First plot','Second plot','Location','NorthWest');

set(h,'FontSize',30);

set(icons(:),'LineWidth',2); %// Or whatever

Which outputs:

Note that I used R2014a so it might be a bit different for R2014b.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!