Writing legends for MATLAB figures with subscripts
    조회 수: 32 (최근 30일)
  
       이전 댓글 표시
    
채택된 답변
  Epsilon
      
 2024년 9월 11일
        
      편집: Epsilon
      
 2024년 9월 11일
  
      Hi Milad,
You can create legends with subscripts by using the LaTeX interpreter. Use the underscore character _ to denote subscripts, and set the interpreter to 'latex'.
Attaching a small code for reference:
x = linspace(0, 2*pi, 100);
y1 = sin(x);
y2 = cos(x);
plot(x, y1, x, y2);
% Create a legend with subscripts
legend({'$y_1 = \sin(x)$', '$y_2 = \cos(x)$'}, 'Interpreter', 'latex');
You can also refer to the documentation Add legend to axes - MATLAB legend (mathworks.com) for further reference.
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




