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