Menu

how to print multiline text/title?

Help
2005-10-05
2013-04-25
  • Nobody/Anonymous

    Hi,

    I tried to print text into figure which consists of more than one line. The obvious approach does not work. Neither '\n' nor '\r\n' are recognised.

    example:

    figure
    plot(0:0.1:2*pi, sin(0:0.1:2*pi), 'b.-');
    text(pi,0,'This is at Pi/0\nThis should appear one line below');
    text(pi,0.5,'This is at Pi/0.5\r\nThis should appear one line below');
    title('Title line 1\nTitle line 2');

    Am I doing something wrong?

    ben

     
    • Shai Ayal

      Shai Ayal - 2005-10-05

      Sorry, no multiline text yet ...
      I will put this in the feature request list. In the meanwhile, you can try doing this manually (e.g. putting two single lines of text one below the other). As for a multiline title - you'll have to wait

      Shai

      p.s. what is Matlb's behaviour in this case ?

       
    • Nobody/Anonymous

      Sorry for the long delay,

      Matlab R12p1 handles multiline text in title seemingly like multiline text in TEXT()

      figure
      tlt = sprintf('this is line1\nthis is line2');
      title(tlt);

      prints a two-line title - although it looks ugly, so I would not recommend using it.

      ben

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.