How do I write a legend with multiple lines?

조회 수: 27 (최근 30일)
Arthur Brigatto
Arthur Brigatto 2015년 5월 27일
댓글: Star Strider 2015년 5월 28일
I'm trying to set a legend on the top of a graph that has a lot of data. If I just orientate it horizontally it simply won't fit the screen and I don't want to set it at neither of the sides as I would waste space. So I'm trying to create a multiple line legend with, say, half of the data on one line and the rest of it on the line below. I've looked on the forums and couldn't figure out a way to do so. Is there any way I can do this? I've even tried setting multiple legends but even that won't work.
Thanks!

채택된 답변

Star Strider
Star Strider 2015년 5월 27일
This works for me:
ts = sprintf('This is a\ntwo-line title');
title(ts)
  댓글 수: 6
Arthur Brigatto
Arthur Brigatto 2015년 5월 28일
Hm, showing it on the area might be a good way to do it.. I'll see if it is plausible.
Thanks again!
Star Strider
Star Strider 2015년 5월 28일
My pleasure!
That would work, but I was initially thinking of something like this to go near the legend:
text(xtxt, ytxt, 'This is what the yellow area represents', 'BackgroundColor','y')

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by