Announcement

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

  • 45 degree-line in Stata graphing

    Dear All,
    Is it possible to fit (not manually using the graphic utilities) 450 line in Stata after drawing, e.g. two-way scatter plot? If yes. How? I'm just after accuracy. Thanks,
    Dapel

  • #2
    I presume you mean the line of equality y = x. If so, yes. Consider this dopey example and also read the help file flagged.

    Code:
     
    sysuse census
    scatter divorce marriage marriage, c(. l) ms(Oh none) sort
    
    
    
    help twoway function

    Comment


    • #3
      I'm there. Thanks a million

      Comment


      • #4
        Hi, is there anyway to draw the 45 degree line on a non-twoway graph? I'm trying to do this using binscatter (community-contributed). Thanks!

        Comment


        • #5
          binscatter is from SSC, as you are asked to explain. I can't see from a quick look at the help and the code that this is allowed, but ask the author directly if he doesn't reply.

          Comment


          • #6
            Try something along the lines of:

            Code:
            binscatter yvar xvar xvar, line(none) ms(Oh none) leg(off)
            graph addplot line xvar xvar

            Comment


            • #7
              Originally posted by Ali Atia View Post
              Try something along the lines of:

              Code:
              binscatter yvar xvar xvar, line(none) ms(Oh none) leg(off)
              graph addplot line xvar xvar
              Works nicely, thanks! Just need to figure out how to include a place in the legend for "y=x".

              Comment


              • #8
                Add - leg(holes(1 2) order(3 "y=x"))- as an option to the graph addplot. Also, this only works if the default scale for the xvar is greater than the default scale for the yvar. I'm glad it seems to work for you now, but in other cases you may need to manually adjust scales.

                Comment

                Working...
                X