Announcement

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

  • Line graph includes undesired lines

    Hi all,

    I am trying to run a simple line graph of a panel dataset that has observations for countries in 20 years. The line graph should depict the average trend of these countries for two variables. Though it does, it also includes another line for both variables (which seems to be a straight line from the first-year value to the last-year value).

    Here's my code:
    Code:
    tsset Country year
    egen mean_gini_swiid = mean(gini_swiid), by(year)
    egen mean_gini_mkt = mean(gini_mkt), by(year)
    line mean_gini_swiid mean_gini_mkt year, legend(off)
    This results in the following graph:
    Click image for larger version

Name:	copy.png
Views:	1
Size:	55.8 KB
ID:	1712680


    How can I get rid of this straight line?

  • #2
    Try adding a sort option.

    Comment


    • #3
      That works indeed, thanks so much Nick

      Comment

      Working...
      X