Announcement

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

  • How to make a three variable line graph?

    Dear all,

    I would like to make a three-variable line graph like the attached one by Kruse et al (2022).

    However, I am struggling to find the right command. I am aiming for a graph just like this one, but I want to plot continents rather than countries (MUS, GHA etc).

    Can somebody help me to find the right command for it? I am still a beginner with Stata.

    Click image for larger version

Name:	Scherm*afbeelding 2023-11-26 om 14.28.58.png
Views:	1
Size:	353.7 KB
ID:	1735175



  • #2
    In Stata terms that graph is 7 y variables and 1 x variable. How do you have 3 variables? Please give a data example, spelling out how you want continents to be represented.

    Meanwhile discussions include https://journals.sagepub.com/doi/pdf...36867X19893641

    Comment


    • #3
      Code:
      webuse grunfeld, clear
      xtset company year
      qui sum year
      xtline invest if inlist(company, 1, 5, 10), overlay leg(off) xtitle("")  ///
      addplot(scatter invest year if inlist(company, 1, 5, 10) & ///
      year== `r(max)', msy(none) mlab(company) mlabc(black) mlabsize(3))
      Click image for larger version

Name:	Graph.png
Views:	1
Size:	51.1 KB
ID:	1735180

      Comment


      • #4
        Originally posted by Nick Cox View Post
        In Stata terms that graph is 7 y variables and 1 x variable. How do you have 3 variables? Please give a data example, spelling out how you want continents to be represented.

        Meanwhile discussions include https://journals.sagepub.com/doi/pdf...36867X19893641
        Essentially, the lines represent a third variable but they are categorical (string?) variables.

        I am aiming to plot the manufacturing employment share for six regions for the span of 1990-2018. So, I'm trying to represent the six continents as six different lines in the graph.

        Comment


        • #5
          Sorry, but that doesn't really answer any of the questions in #2. Code would differ according to whether values for the continents are held in 6 separate variables, or the continents themselves are 6 distinct values of a single grouping variable. There are suggestions of code in the paper cited in #2 and in #3.

          If you need more help please give a data example as explained at 12.2 in https://www.statalist.org/forums/help#stata

          Comment

          Working...
          X