In Matlab, the following generates a black color on the specified line in the legend:
leftAxis = sprintf('left y-axis','Color','r');
leg = legend([.. bla bla ..], sprintf('test [%s]', leftAxis), etc... );
What I'm trying to achieve is two colors on the same line in the legend. (so in this example the part 'test' should be black and the part 'left y-axis' should be red.
What I've tried:
A picture to visualise what I mean:
Probably you mistyped tex string:
figure
hold on
line1H=plot(1:10,1:10);
line2H=plot(1:10,2*(1:10),'r');
leg{1} = 'BlackText {\color{blue}line1} BlackAgain';
leg{2} = 'BlackText {\color{red}line2} BlackAgain';
legend([line1H,line2H],leg{:})
Generates:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With