Announcement

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

  • Subcommand "order" in twoway legend command producing unexpected results

    I have a twoway command with five plots. I include an legend command that indicates that has an order subcommand of the form 1 plot1 2 plot2 3 plot3. Note that plots 1, 2, and 3 are all "lfits" and the other two are scatterplots. What the legend ends up showing is plot3, plot 4, and plot2 in that order. I have tried changing the order of the five plots but I still can't get the right info in the legend.

    Am I missing something or is this a bug?

    FYI, here is the full actual command:

    twoway (lfit Recent Pop, lcolor(blue) lpattern(shortdash)) ///
    (lfit Recent NumJudges,xaxis(2) lcolor(red) lpattern(dash)) ///
    (lfit NumJudges Pop,lcolor(black) lpattern(solid) yaxis(2)) ///
    (scatter Recent Pop, mcolor(blue) mlabel(Lab) mcolor(blue)) ///
    (scatter Recent NumJudges,msymbol(smsquare) xaxis(2) mlabel(Lab) ///
    mlabcolor(red) mcolor(red)), ///
    legend(order(1 "NumJud by Pop" 2 "NumRec by Pop" 3 "NumRec by NumJ") ///
    rows(1) size(*.6)) ///
    graphregion(color(white)) ytitle(Number of Judges,axis(2)) ytitle(Number of Cases) ///
    xtitle(Population in Millions,axis(2)) xtitle(Number of Judges)

  • #2
    The principle is that the legend is ordered by outcome or response variables (appearing on the y axis) in the order in which they are mentioned in your syntax.

    But your syntax is so puzzling that the legend is not the main issue.

    This subset of plots should make sense

    Code:
    lfit Recent Pop
    lfit NumJudges Pop 
    scatter Recent Pop
    as should this if it makes sense to regard NumJudges as a predictor

    Code:
    lfit Recent NumJudges  
    scatter Recent NumJudges
    but the two subsets can't obviously be superimposed without risk of major confusion.




    Comment

    Working...
    X