Announcement

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

  • Adding average line in Line-Chart?

    Hi, I recently asked a question (here) - which I got a great answer for. I got a related answer today: I want to add an average line to an ensemble of line in one chart. Here is what my chart looks like so far:
    Click image for larger version

Name:	line_sales_time.png
Views:	1
Size:	114.2 KB
ID:	1391504



    It is a nice little line chart I created from sales data of several stores over time. I am trying to create an "average store" so to speak. How would I go about to do that? Any ideas? Sofar, I experimented with collapse, but that only brought me to a single "average" line.

    Best / R
    Last edited by Rachel Sleeps; 08 May 2017, 03:53.

  • #2
    Calculate something like

    Code:
    egen average_sales = mean(monthly_sales_by_size), by(year_month)
    and then add as an extra line.

    Comment


    • #3
      Ah, perfect! Thank you! I didn't know it's possible to add several lines at once. The help function could have brought me here - but you did, Nick! Thank you!

      Comment

      Working...
      X