Announcement

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

  • Problems with legend in a twoway plot with lfitci

    Hello,

    Im have created a twoway plot with 2 overlaid linear fit lines using the following code:

    twoway (lfitci frailty_fem ageatlastwave) (lfitci frailty_male ageatlastwave, clpattern(dash))

    This works fine. However, I want to amend the legend - so i have tried the following but neither work:

    twoway (lfitci frailty_fem ageatlastwave) (lfitci frailty_male ageatlastwave, clpattern(dash)) ///
    legend(order(1 "linear fit females" 2 "linear fit males"))

    twoway (lfitci frailty_fem ageatlastwave) (lfitci frailty_male ageatlastwave, clpattern(dash)) ///
    legend(lab(1 "linear fit females") lab(2 "linear fit males"))

    Stata gives the following error message:
    ) required
    r(100);

    Grateful if someone could advise what I am doing wrong here (ive googled and looked for existing advice on here with no success).

    Many thanks

  • #2
    I was missing an all important comma!!

    twoway (lfitci frailty_fem ageatlastwave) (lfitci frailty_male ageatlastwave, clpattern(dash)), ///
    ytitle(frailty score) xtitle(age at last wave) legend(order(2 "linear fit females" 4 "linear fit males"))

    Comment

    Working...
    X