Announcement

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

  • Marking the shading area around the line on the graph

    Dear All,

    Since few hours I'm trying to work out how to mark the variation around the line presenting the mean on the graph.
    I have panel data from 2005 till 2021 on the companie's indicators. I wanted to present how the indicator A evolved over time. Normally I show the mean, maximum and minimum. I calculated the mean for each year. To figure out the minimum and maximum I used:

    Code:
    separate indA, by(firm_nr)
    And then plotted indA1-indA6 over time to figure out the minimum and maximum. However, it was hard to find such an indicator because of the substantial variation over time.
    I would like to show the mean and the variation of the indicators by shadowing the area around the line, so that it would show how the other indicators evolved over time. What I would like to do the most is to draw the mean and mark the area related to the evolution of indA1-indA6

    Could anybody provide me with the idea how to do it? I saw the paper in Stata Journal but it was about shading parts related to time span. I tried fpfitci but wasn't successful as well

  • #2
    Your question did not attract much attention due to lack of a data example. To increase your chances of obtaining helpful replies in the future, provide one as recommended in FAQ Advice #12. A guess of what you want is:

    Code:
    webuse grunfeld, clear
    collapse (min) min= invest (max) max= invest (mean) invest, by(year)
    set scheme s1color
    tw (rarea min max year, sort color(black%10)) ///
    (line invest year, sort lw(medthick)), xtitle("") leg(off) ///
    xlab(1935(4)1951 1954) title("Mean invest over time")
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	38.2 KB
ID:	1667850

    Last edited by Andrew Musau; 04 Jun 2022, 15:15.

    Comment


    • #3
      Thank you Andrew for your kind help! It was exactly what I wanted to obtain.

      Comment

      Working...
      X