Announcement

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

  • xline and text on top of twoway area plot

    I use
    Code:
    twoway (area y1 y2 year)
    to create a plot and want to include a dashed vertical line on top of the plot. However, the xline command is always covered by the area plot. Is there a way to keep both the xline and text on top?

  • #2
    Use twoway scatteri with the option -recast(line)- or twoway dropline in place of -xline-. There are plenty of examples in the forum that address this problem if you search.

    Comment


    • #3
      xline() is an option, not a command, but more importantly for you this is the intended behaviour. You need another way to show a line through another twoway subcommand. Here's one of several techniques:


      Code:
      webuse grunfeld, clear
      line invest year if company == 1
      line invest year if company == 1 || scatteri 0 1939 1500 1939, recast(line) legend(off) ytitle("`: var label invest'")

      Comment

      Working...
      X