Announcement

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

  • Short reference lines in Stata

    Using the twoway() command, how do I add a reference line that runs from say (1,0) to (1,10)? The option xline(1) almost works, but it runs all the way to the top of the graph. I only want to run up to y=10.
    Last edited by paulvonhippel; 14 Jun 2018, 13:49.

  • #2
    You can add a second tw using the ||-notation:
    Code:
    tw scatteri -5 -5  15 5 || pci  0 1 10 1
    Last edited by Bjarte Aagnes; 14 Jun 2018, 14:32.

    Comment


    • #3
      I'm sure you know this, but it can be helpful to others: the quick way is to use the "add line" tool.
      Last edited by Marcos Almeida; 14 Jun 2018, 15:02.
      Best regards,

      Marcos

      Comment


      • #4
        The "add line" tool in the Graph Editor?

        Comment


        • #5
          The -pci- approach suggested by Bjarte Aagnes in #2 is the way to go, I think. Here's another example of that approach.

          Code:
          clear *
          sysuse auto
          graph twoway scatter mpg weight || pci  15 2500 25 2500
          Click image for larger version

Name:	short-reference-line.png
Views:	1
Size:	27.4 KB
ID:	1450782
          --
          Bruce Weaver
          Email: [email protected]
          Web: http://sites.google.com/a/lakeheadu.ca/bweaver/
          Version: Stata/MP 18.0 (Windows)

          Comment

          Working...
          X