Announcement

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

  • Line graph with different style for forecasted values

    Hello,

    I have some values which are both historical and forecasted. Let's say that from 2000q1 to 2018q4 the values are historical, and from 2019q1 to 2019q4 - forecasted. I want to plot these values in a line graph, historical values being a continous line and forecasted values being a dashed line, but to come in the continuity of the continous line.
    I would appreciate any suggestions.

  • #2
    This should indicate technique:

    Code:
    webuse grunfeld, clear
    
    line invest year if company == 1 & year < 1950, lc(orange) lp(solid) ///
    || line invest year if company == 1 & year >= 1949, lc(blue) lp(dash) legend(order(1 "data" 2 "forecast"))

    Comment


    • #3
      Originally posted by Nick Cox View Post
      This should indicate technique:

      Code:
      webuse grunfeld, clear
      
      line invest year if company == 1 & year < 1950, lc(orange) lp(solid) ///
      || line invest year if company == 1 & year >= 1949, lc(blue) lp(dash) legend(order(1 "data" 2 "forecast"))
      Thanks a lot, Nick, this is exactly what I want.
      Cheers!

      Comment

      Working...
      X