Announcement

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

  • Adding line breaks in X axis tick labels

    I'd like to insert a line break in the label for each tick on my X axis. I found this older article on the topic, but this method no longer seems to work:

    http://www.stata-journal.com/sjpdf.h...iclenum=gr0020

    That article specifies that the whole label should be encapsulated in '" and "'; and that each line be encapsulated in double quotes. However, I get a "type Mismatch" error when I try that.
    Here's the code:

    . marginsplot, recast(bar) xlabel(1 '" "Hi-Educ." "Rep" "' 2 '" "Hi-Educ." " Dem" "' 3 '" "Lo-Educ." " Rep." "' 4 '" "Lo-Educ" " Dem." "')
    > title ("Fear") xtitle("Party Affiliation") ytitle("Fear") legend(off) scheme(s1mono)

  • #2
    The method is still sound. I can't test your example because you don't give data that can be copied and pasted. But copying your syntax I get

    Code:
    marginsplot, recast(bar) xlabel(1 '" "Hi-Educ." "Rep" "' 2 '" "Hi-Educ." " Dem" "' 3 '" "Lo-Educ." " Rep." "' 4 '" "Lo-Educ" " Dem." "')
    title ("Fear") xtitle("Party Affiliation") ytitle("Fear") legend(off) scheme(s1mono)
    from which it appears that you are not typing the correct single quotes. Opening and closing single quotes are different characters. Your opening quote should be a different character. The point is also explained in a concurrent thread.

    See http://www.statalist.org/forums/foru...ts-of-commands #7
    Last edited by Nick Cox; 26 Nov 2015, 09:38.

    Comment

    Working...
    X