MATLAB: Avoid lower case in legend by plotting legend with ‘DisplayName’

plotundercase

Hello,
I have again a similar Problem, but in this case I can't separate legend, and : 'Interpreter','none' is here also not working. How can I print names like 001_M1_Distance_0.5m_AKG_C1000S_F1_MS1 without undercases?
label1 = extractBefore({i(j).name}, ".mat");
label1 = extractAfter(label1, "_");
...........
if any(M1)
plot(M1(:,2),M1(:,1),'-o','DisplayName',label1{1});
hold on
end
if any(M2)
plot(M2(:,2),M2(:,1),'-o','DisplayName',label2{1});
hold on
end
if any(M3)
plot(M3(:,2),M3(:,1),'-o','DisplayName',label3{1});
hold on
end
if any(M4)
plot(M4(:,2),M4(:,1),'-o','DisplayName',label4{1});
hold on
end
Thanks!

Best Answer

Use the 'Interpreter', 'none' option in legend():
% Read headers
plot(1:10);
hold on
plot(4:14);
legend('plot_1', 'plot_2', 'Interpreter', 'none', 'Location', 'Northwest');