Announcement

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

  • marginsplot and legend labels

    Hello,
    I'm attempting to graph a margins plot, but my legend labels command doesn't change the labels to what I'm specifying. Here is my code:

    quietly margins, at(yrsbcs=(-2(2)10) cfarmsx = (-6, 0, 2))
    marginsplot, noci scheme(sj) ytitle("Predicted chronic absence") xtitle("Years of Implementation") /*
    */legend(label(1 "lowest poverty") label(2 "Mean poverty") label(3 "Highest poverty"))

    The legend for cfarmsx that appears still has the 3 values labeled as cfarmsx=6, cfarmsx=0, instead of "lowest poverty", "mean poverty", etc.

    I also tried specifying labels for the values of -6, 0 and 2, but that doesn't work either. Any ideas how to give the legend the right labeling?

    Thanks in advance!
    Jane

  • #2
    Please read the FAQ. There you'll find information about sharing data/command/output.

    You unfortunately didn't share data to work on, This being said, you may wish to add - legend (order(1 "blablabla" 2 "blablabla")) - to the code above.

    Hopefully that helps.
    Last edited by Marcos Almeida; 25 Nov 2018, 15:08.
    Best regards,

    Marcos

    Comment


    • #3
      Hoooray! That worked! Thank you so much for the quick assistance, Marcos!

      -Jane

      Comment


      • #4
        Thank you for the feedback and for informing you consider this thread reached a satisfactory end.
        Best regards,

        Marcos

        Comment


        • #5
          I found this thread after having a similar problem. The workaround in post #2 is good, but it is baffling me how no combination of legend and label can apparently do what the OP was trying to do. Almost seems like a bug, tbh.

          Comment

          Working...
          X