Announcement

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

  • Twoway Scatter help: Change range, show labels and Bisector line

    Hello. I am trying to do a twoway scatter graph. The first problem i faced was that the range was not the same at both the axis. I fixed this with the xscale, yscale command. This is my command now and it works:

    graph twoway scatter TurnoutFOE TurnoutSOE, xscale(range(0 100)) yscale(range(0 100))

    However, I would also like to show labels for my points on the graph. This can be done with and it works:

    graph twoway scatter TurnoutSOE TurnoutFOE,mlabel(Countries)

    But when I try do combine them I can not do it.
    graph twoway scatter TurnoutFOE TurnoutSOE,mlabel(Countries), xscale(range(0 100)) yscale(range(0 100))

    Gives me the message: Invalid varlist

    graph twoway scatter TurnoutFOE TurnoutSOE, xscale(range(0 100)) yscale(range(0 100)), mlabel(Countries)

    Gives me the message: Countries: may not use time-series operators on string variables

    How do i solve this??

    Furhtermore, I would like to also add a bisector. Meaning a 45degree line in the graph.

    Can someone please help me of write the full command to make all this work?

    Thanks
    ​​​​​​​Andreas

  • #2
    remove comma before xscale is a start in
    Code:
    graph twoway scatter TurnoutFOE TurnoutSOE,mlabel(Countries), xscale(range(0 100)) yscale(range(0 100))
    or use braces:
    Code:
    graph twoway (scatter TurnoutFOE TurnoutSOE,mlabel(Countries)), xscale(range(0 100)) yscale(range(0 100))
    Kind regards

    nhb

    Comment


    • #3
      PS Wrong fora. This is for Mata.
      Hope the above works for you
      Kind regards

      nhb

      Comment


      • #4
        Thanks Niels, yes I noticed that I posted in the wrong forum. I apologize for that but I did not want to make another thread and spam the forums.

        I got it to work thank you. However, I still need help with plotting a bisector, dividing the graph. Now I am doing it manually using the graph editor but it doesnt seem like an accurate way

        Comment


        • #5
          Is this what you need?
          Code:
          sysuse auto
          twoway (scatter price  price,mlabel(make)) (function y=x, range(0 20000)), xscale(range(0 20000)) yscale(range(0 20000))
          Kind regards

          nhb

          Comment


          • #6
            Yes, thank you sir!

            Comment

            Working...
            X