Announcement

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

  • how do I restrict xtline height?

    Hey, I am using the command xline to generate these two red lines. I don't know how to make the height of the line stay within the confines of the graph region. 40 on the left is the highest value on the y-axis. I have seem something like "noextend" but not sure how to incorporate that code or if there are other solutions.

    [ATTACH=CONFIG]n1456713[/ATTACH]

  • #2
    pic of what I am talking about
    Attached Files

    Comment


    • #3
      Code:
      help twoway scatteri

      Comment


      • #4
        I must be missing something because I don't see how scatteri would help in this case. It looked helpful for scattering labels through out the graph but I didn't see anything connected to reducing the height of an existing line. I know that tline or xtline can both generate a line at a specified point but I don't know how to make the out stay within the bounds of the graph. Sorry if I missed something with this comment..

        Comment


        • #5
          The help flags what you need: (I've corrected an obvious typo below):

          Programmers: Note carefully scatteri's advanced_option recast(); see [G-3] advanced_options. It can
          be used to good effect, such as using scatteri to add areas, bars, spikes, and dropped lines.

          Here is an example you can run:


          Code:
          webuse grunfeld , clear
          xtline invest , overlay ysc(log) yla(1000 100 10 1, ang(h)) legend(off) addplot(scatter invest year if year == 1954, ms(none) mla(company) mlabcolor(black) || scatteri 1 1939 1000 1939, recast(line))
          See also (e.g.) https://www.statalist.org/forums/for...-eqprhistogram and its references.

          Comment

          Working...
          X