Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multi-line labels, titles, etc.

    I'm recasting a v19 Wishlist request to a General forum posting of questions.

    Yesterday on the Wishlist I posted this https://www.statalist.org/forums/for...92#post1769092:

    Originally posted by John Mullahy View Post
    Stata's -twoway- graphs easily handle multi-line titles, axis titles, etc. e.g.
    Code:
    scatter price mpg, t1("This is the t1 Title" "Shown in" "Three Lines")
    Code:
    scatter price mpg, xti("This is the x-axis Title" "Shown in Two Lines")
    It would sometimes be handy if axis labels could be shown in multiple lines but current capabilities don't allow this (unless I've missed something).

    For instance, I might want to show something like
    Code:
    scatter price mpg, xlab(10 21.3 "Mean=" "21.3" 40)
    but that does not work.

    Curiously that xlab specification produces gibberish but does not generate an error but this one does
    Code:
    . scatter price mpg, xlab(10 21.3 "L1" "L2" 40)
    invalid label specifier, : 10 21.3 "L1" "L2" 40:
    r(198);

    Maarten Buis helpfully provided a solution:

    The label needs to be surrounded by compound quotes:

    Code:
    scatter price mpg, xlab(10 21.3 `""Mean=" "21.3""' 40)

    My questions:

    1. Is the use of compound quotes to create multi-line axis labels documented anywhere? I was unable to find such documentation.

    2. In the final part of my Wishlist posting why would the two different labels

    a) "Mean=" "21.3"

    and

    b) "L1" "L2"

    result in different behavior regarding generation of an error message?

    3. I tried Maarten's compound quote approach to generate multi-line titles and axis titles and in those cases it does not work.


    Thanks in advance for any insights.

  • #2
    Code:
    SJ-5-3  gr0020  . . . . . . .  Stata tip 24: Axis labels on two or more levels
            . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
            Q3/05   SJ 5(3):469                              (no commands)
            tip for specifying axis labels on multiple levels
    I couldn't have written that if I hadn't learned about the feature somehow, but whether it's documented under some graphical heading I don't know.

    Perhaps I just guessed that what works in one context would work in another context.

    It is a puzzle to me too why you need compound double quotes in one place and not another. My own code isn't always consistent either on various small things.
    Last edited by Nick Cox; 10 Dec 2024, 08:49.

    Comment

    Working...
    X