MATLAB Answers

I want my legend just like the pic. 2 variables in 2 columns at the same legend

조회 수: 2(최근 30일)
Ali Algushti
Ali Algushti 2021년 5월 26일
댓글: Ali Algushti 2021년 5월 26일
N = [10 20 30 40 50];
M = [1 2 3 4 5];
x = linspace(0, 1, 17);
plot(x, N.*x.')
legendString = "N = " + string(N);
legendStrings = "M = " + string(M);

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2021년 5월 26일
Solve the problem at the root:
legendString = "N = " + string(N) + ", M = " + string(M);
ph = plot(x,N.*x'); % Better controll using the plot-handle.
  댓글 수: 4
Ali Algushti
Ali Algushti 2021년 5월 26일
they are not in the same order as the plot .
because I'm plotting N, M first then K, M so what you are suggesting isn't fit with the figure because it shows N, M then K, M and Again N, M and so on

댓글을 달려면 로그인하십시오.

추가 답변(0개)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by