Announcement

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

  • coefplot label break across 2 lines

    Hello,
    I would like to add a line break to the labels of the variables across two lines - so for example, where it says "long name 2" I would like to have "long <line break> name 2" so that I can make the graph more concise and not have the labels overlap. could you please help me with this, thank you!


    Code:
    coefplot m1, ///
        keep(variable1 variable2 variable3 variable4 variable5) ///
        recast(bar) ciopts(recast(rcap) color(grey)) barwidth(0.35) ///
        rename(variable1="Long Name 1" variable2="Long Name 2" variable3="Long Name 3" variable4="Long Name 4" variable5="Long Name 5") ///
        vertical xline(0, lpattern(dash)) ///
        ytitle("Outcome Variable") ylabel(, angle(0) labsize(small)) ///
        title("Title of the Plot", size(medsmall)) ///
        bcolor(red%30)

  • #2
    If you use the option coeflabels instead of rename, you can use the syntax coeflabels(variable1 = `" "Long" "Name 1" "' variable2 = `" "Long" "Name 2" "')

    Also, as you are requested to
    explain for the sake of other forum users trying to follow the thread (see the Statalist FAQ, esp #12), coefplot is a community-contributed command available from the Stata Journal.
    Last edited by Hemanshu Kumar; 18 May 2025, 22:21.

    Comment

    Working...
    X