Announcement

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

  • Line plot displaying lines not defined by the data

    I am trying to present the labour force participation trends across EU countries from 1990 to 2022. I noticed there are linear lines not corresponding to the dataset present in the plot. The data set is balanced. I used the basic code -twoway line mLFP fLFP year, legend(label(1 "mLFP") label(2 "fLFP")). I can't seem to find an explanation for this.
    Click image for larger version

Name:	GENDERED LFP EU-13.png
Views:	1
Size:	265.2 KB
ID:	1717320

    Last edited by anja summer; 15 Jun 2023, 15:45.

  • #2
    Code:
    twoway line mLFP fLFP year, legend(label(1 "mLFP") label(2 "fLFP")) sort

    Comment


    • #3
      Thank you, Clyde, for your response, however adding sort at the end seems to not help. This is the graph I get.
      Click image for larger version

Name:	Graph.png
Views:	1
Size:	108.9 KB
ID:	1717349

      Comment


      • #4
        This is a problem with your data, not with the graph: For each year you have multiple values of mLFP and fLFP. You need to decide which of these Stata should draw. That is something you need to fix first before graphing.
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          I guess the issue here is that you have multiple countries. So, try some equivalent of

          Code:
          sort country year
          and add the option

          Code:
          c(L L)
          to your graph command.
          Last edited by Nick Cox; 16 Jun 2023, 02:45.

          Comment


          • #6
            Thank you all for your replies! The issue is fixed with the use of Nick's code!

            Comment

            Working...
            X