In Matlab, the following generates black in the specified string 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 one line in a legend. (therefore, in this example, the 'test' part should be black and the 'left y-axis' part should be red.
What I tried:
- Execution of the above: no result.
- Getting string arguments from a legend and changing color: the color of the entire string.
- Using LaTeX to color text: no result.
Image for visualizing what I mean:

source share