Announcement

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

  • Graphs

    I have an issue with graphs in Stata. I want to put all the tendency line of the data of my reserach, which are bellow, in an unique graph.

  • #2
    The link was broken, but this will work:

    Comment


    • #3
      We ask that graphical attachments be .png files and that data examples are dataex output presented as CODE. I won't click on a kind of link I've never seen before but I can't speak for anyone else.

      Comment


      • #4
        Originally posted by Nick Cox View Post
        We ask that graphical attachments be .png files and that data examples are dataex output presented as CODE. I won't click on a kind of link I've never seen before but I can't speak for anyone else.
        Sorry for that, it did not occured to me. There is the dataex:

        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input byte Code str39 Region double Percentagechange int Year
         1 "Água Boa"                                                 . 1980
         2 "Alta Floresta"                                             . 1980
         3 "Barra do Garças"                        -.06008510752105902 1980
         4 "Cáceres"                                -.08384806992411481 1980
         5 "Confresa - Vila Rica"                     .05225044448665927 1980
         6 "Cuiabá"                                 -.08689778237161118 1980
         7 "Diamantino"                               .04691419297464471 1980
         8 "Jaciara"                                 -.17229414843544852 1980
         9 "Juara"                                   -.08065178778284039 1980
        10 "Juína"                                   .38379742500130193 1980
        11 "Mirassol D'oeste"                                          . 1980
        12 "Peixoto de Azevedo - Guarantã do Norte"                   . 1980
        13 "Pontes e Lacerda - Comodoro"             -.12234473480917159 1980
        14 "Primavera do Leste"                      -.08496689314864081 1980
        15 "Rondonópolis"                           -.12482553388779954 1980
        16 "Sinop"                                                     . 1980
        17 "Sorriso"                                                   . 1980
        18 "Tangará da Serra"                       -.08398190431372582 1980
         1 "Água Boa"                               -.15438843498130037 1991
         2 "Alta Floresta"                            -.2535786365064404 1991
         3 "Barra do Garças"                        -.24329282959597795 1991
         4 "Cáceres"                                 -.2050421567524351 1991
         5 "Confresa - Vila Rica"                     -.0412444967170531 1991
         6 "Cuiabá"                                 -.16366963545126606 1991
         7 "Diamantino"                              -.16674446045025912 1991
         8 "Jaciara"                                  -.2755455462479105 1991
         9 "Juara"                                   -.24991556794145486 1991
        10 "Juína"                                  -.19421309259512587 1991
        11 "Mirassol D'oeste"                        -.23398075580937858 1991
        12 "Peixoto de Azevedo - Guarantã do Norte"                   . 1991
        13 "Pontes e Lacerda - Comodoro"             -.15415821718885336 1991
        14 "Primavera do Leste"                      -.18816577844686214 1991
        15 "Rondonópolis"                           -.21856573650387726 1991
        16 "Sinop"                                   -.22143647427565855 1991
        17 "Sorriso"                                                   . 1991
        18 "Tangará da Serra"                       -.28029639996767064 1991
         1 "Água Boa"                               -.21824148889043815 2000
         2 "Alta Floresta"                           -.15027494671646802 2000
         3 "Barra do Garças"                        -.24835414248108242 2000
         4 "Cáceres"                                 -.2757744669997463 2000
         5 "Confresa - Vila Rica"                    -.22232978972839942 2000
         6 "Cuiabá"                                 -.27376583045681907 2000
         7 "Diamantino"                              -.21411434752552821 2000
         8 "Jaciara"                                 -.21780624155789619 2000
         9 "Juara"                                   -.17129220266557557 2000
        10 "Juína"                                  -.15330409835882527 2000
        11 "Mirassol D'oeste"                        -.26882496693616487 2000
        12 "Peixoto de Azevedo - Guarantã do Norte" -.04818560434568292 2000
        13 "Pontes e Lacerda - Comodoro"             -.22368534407553903 2000
        14 "Primavera do Leste"                       -.2520019875713071 2000
        15 "Rondonópolis"                           -.21829201138174692 2000
        16 "Sinop"                                   -.11910603631075121 2000
        17 "Sorriso"                                 -.12400748798609189 2000
        18 "Tangará da Serra"                       -.16785354286232468 2000
         1 "Água Boa"                               -.16420716062163168 2010
         2 "Alta Floresta"                            -.2670525599533991 2010
         3 "Barra do Garças"                         -.2424519746464306 2010
         4 "Cáceres"                                -.22111143931739888 2010
         5 "Confresa - Vila Rica"                    -.22955354827912486 2010
         6 "Cuiabá"                                 -.25680734354066626 2010
         7 "Diamantino"                               -.2682841416379935 2010
         8 "Jaciara"                                 -.21204748365501713 2010
         9 "Juara"                                    -.2530283528756139 2010
        10 "Juína"                                   -.1971163351289026 2010
        11 "Mirassol D'oeste"                         -.2492789793277667 2010
        12 "Peixoto de Azevedo - Guarantã do Norte" -.30156952334714937 2010
        13 "Pontes e Lacerda - Comodoro"             -.21271704137818692 2010
        14 "Primavera do Leste"                       -.2473932993887724 2010
        15 "Rondonópolis"                           -.24515381366806735 2010
        16 "Sinop"                                   -.27407315215005146 2010
        17 "Sorriso"                                 -.28189874838400986 2010
        18 "Tangará da Serra"                        -.2455601626309098 2010
         1 "Água Boa"                               -.14983361049909322 2022
         2 "Alta Floresta"                           -.17145092706861492 2022
         3 "Barra do Garças"                        -.13389433689431263 2022
         4 "Cáceres"                                -.17327143539599144 2022
         5 "Confresa - Vila Rica"                      -.189163174498579 2022
         6 "Cuiabá"                                 -.10424710506207788 2022
         7 "Diamantino"                              -.12931575158153444 2022
         8 "Jaciara"                                 -.10410922289232478 2022
         9 "Juara"                                   -.13776937620919136 2022
        10 "Juína"                                    -.208650707868511 2022
        11 "Mirassol D'oeste"                        -.16652539900825755 2022
        12 "Peixoto de Azevedo - Guarantã do Norte" -.13074995939714895 2022
        13 "Pontes e Lacerda - Comodoro"             -.16826278923382212 2022
        14 "Primavera do Leste"                      -.07651861274148061 2022
        15 "Rondonópolis"                           -.07137861930348906 2022
        16 "Sinop"                                   -.15844301006282394 2022
        17 "Sorriso"                                 -.05915563594073348 2022
        18 "Tangará da Serra"                        -.1470847410009482 2022
        end

        Comment


        • #5
          Thanks for that! Now please tell us more about what kind of graph you're seeking.

          Comment


          • #6
            Originally posted by Nick Cox View Post
            Thanks for that! Now please tell us more about what kind of graph you're seeking.
            Mr Cox, I need to put Percentagechange in the y axis and Year in the x axis. However, The content of the graph need to have the observations for each Region, whose names are on this variable name, in onther words, all that data will be in the same graph. If it is possible, I want to put the data only with a tendency line.

            Comment


            • #7
              I am not clear what that means. Here is one take on your data. myaxis is from the Stata Journal.

              %changes of the order of 0.2 seem very small. Could it be that these are proportional changes?

              Code:
              * Example generated by -dataex-. For more info, type help dataex
              clear
              input byte Code str39 Region double Percentagechange int Year
               1 "Água Boa"                                                 . 1980
               2 "Alta Floresta"                                             . 1980
               3 "Barra do Garças"                        -.06008510752105902 1980
               4 "Cáceres"                                -.08384806992411481 1980
               5 "Confresa - Vila Rica"                     .05225044448665927 1980
               6 "Cuiabá"                                 -.08689778237161118 1980
               7 "Diamantino"                               .04691419297464471 1980
               8 "Jaciara"                                 -.17229414843544852 1980
               9 "Juara"                                   -.08065178778284039 1980
              10 "Juína"                                   .38379742500130193 1980
              11 "Mirassol D'oeste"                                          . 1980
              12 "Peixoto de Azevedo - Guarantã do Norte"                   . 1980
              13 "Pontes e Lacerda - Comodoro"             -.12234473480917159 1980
              14 "Primavera do Leste"                      -.08496689314864081 1980
              15 "Rondonópolis"                           -.12482553388779954 1980
              16 "Sinop"                                                     . 1980
              17 "Sorriso"                                                   . 1980
              18 "Tangará da Serra"                       -.08398190431372582 1980
               1 "Água Boa"                               -.15438843498130037 1991
               2 "Alta Floresta"                            -.2535786365064404 1991
               3 "Barra do Garças"                        -.24329282959597795 1991
               4 "Cáceres"                                 -.2050421567524351 1991
               5 "Confresa - Vila Rica"                     -.0412444967170531 1991
               6 "Cuiabá"                                 -.16366963545126606 1991
               7 "Diamantino"                              -.16674446045025912 1991
               8 "Jaciara"                                  -.2755455462479105 1991
               9 "Juara"                                   -.24991556794145486 1991
              10 "Juína"                                  -.19421309259512587 1991
              11 "Mirassol D'oeste"                        -.23398075580937858 1991
              12 "Peixoto de Azevedo - Guarantã do Norte"                   . 1991
              13 "Pontes e Lacerda - Comodoro"             -.15415821718885336 1991
              14 "Primavera do Leste"                      -.18816577844686214 1991
              15 "Rondonópolis"                           -.21856573650387726 1991
              16 "Sinop"                                   -.22143647427565855 1991
              17 "Sorriso"                                                   . 1991
              18 "Tangará da Serra"                       -.28029639996767064 1991
               1 "Água Boa"                               -.21824148889043815 2000
               2 "Alta Floresta"                           -.15027494671646802 2000
               3 "Barra do Garças"                        -.24835414248108242 2000
               4 "Cáceres"                                 -.2757744669997463 2000
               5 "Confresa - Vila Rica"                    -.22232978972839942 2000
               6 "Cuiabá"                                 -.27376583045681907 2000
               7 "Diamantino"                              -.21411434752552821 2000
               8 "Jaciara"                                 -.21780624155789619 2000
               9 "Juara"                                   -.17129220266557557 2000
              10 "Juína"                                  -.15330409835882527 2000
              11 "Mirassol D'oeste"                        -.26882496693616487 2000
              12 "Peixoto de Azevedo - Guarantã do Norte" -.04818560434568292 2000
              13 "Pontes e Lacerda - Comodoro"             -.22368534407553903 2000
              14 "Primavera do Leste"                       -.2520019875713071 2000
              15 "Rondonópolis"                           -.21829201138174692 2000
              16 "Sinop"                                   -.11910603631075121 2000
              17 "Sorriso"                                 -.12400748798609189 2000
              18 "Tangará da Serra"                       -.16785354286232468 2000
               1 "Água Boa"                               -.16420716062163168 2010
               2 "Alta Floresta"                            -.2670525599533991 2010
               3 "Barra do Garças"                         -.2424519746464306 2010
               4 "Cáceres"                                -.22111143931739888 2010
               5 "Confresa - Vila Rica"                    -.22955354827912486 2010
               6 "Cuiabá"                                 -.25680734354066626 2010
               7 "Diamantino"                               -.2682841416379935 2010
               8 "Jaciara"                                 -.21204748365501713 2010
               9 "Juara"                                    -.2530283528756139 2010
              10 "Juína"                                   -.1971163351289026 2010
              11 "Mirassol D'oeste"                         -.2492789793277667 2010
              12 "Peixoto de Azevedo - Guarantã do Norte" -.30156952334714937 2010
              13 "Pontes e Lacerda - Comodoro"             -.21271704137818692 2010
              14 "Primavera do Leste"                       -.2473932993887724 2010
              15 "Rondonópolis"                           -.24515381366806735 2010
              16 "Sinop"                                   -.27407315215005146 2010
              17 "Sorriso"                                 -.28189874838400986 2010
              18 "Tangará da Serra"                        -.2455601626309098 2010
               1 "Água Boa"                               -.14983361049909322 2022
               2 "Alta Floresta"                           -.17145092706861492 2022
               3 "Barra do Garças"                        -.13389433689431263 2022
               4 "Cáceres"                                -.17327143539599144 2022
               5 "Confresa - Vila Rica"                      -.189163174498579 2022
               6 "Cuiabá"                                 -.10424710506207788 2022
               7 "Diamantino"                              -.12931575158153444 2022
               8 "Jaciara"                                 -.10410922289232478 2022
               9 "Juara"                                   -.13776937620919136 2022
              10 "Juína"                                    -.208650707868511 2022
              11 "Mirassol D'oeste"                        -.16652539900825755 2022
              12 "Peixoto de Azevedo - Guarantã do Norte" -.13074995939714895 2022
              13 "Pontes e Lacerda - Comodoro"             -.16826278923382212 2022
              14 "Primavera do Leste"                      -.07651861274148061 2022
              15 "Rondonópolis"                           -.07137861930348906 2022
              16 "Sinop"                                   -.15844301006282394 2022
              17 "Sorriso"                                 -.05915563594073348 2022
              18 "Tangará da Serra"                        -.1470847410009482 2022
              end
              
              gen Region2 = Region 
              replace Region2 = trim(substr(Region2, 1, strpos(Region, " -") )) if strpos(Region, "-")
              
              myaxis Region3=Region2, sort(mean Percent) subset(Year == 2022)
              
              twoway connected Percentagechange Year , by(Region3, note("") compact col(3)) xtitle("") ///
              ysize(8)

              Click image for larger version

Name:	daves.png
Views:	1
Size:	107.3 KB
ID:	1766287

              Comment


              • #8
                As a refinement to my previous, consider

                Code:
                 xla(1980 1991 2000 2010 2022, format(%tyYY))
                which shows the years for which there are data -- and avoids the collision even between 1980 and 2020 axis labels -- with the cost of abbreviations to 80 91 00 10 22.

                Comment


                • #9
                  To make the comparison between regions easier, Daves could use fabplot (by Nick Cox, type in Stata ssc install fabplot to install it)

                  Code:
                  fabplot connected Percentagechange Year , by(Region3, note("") compact col(3)) xtitle("") ///
                  ysize(8) xla(1980 1991 2000 2010 2022, format(%tyYY))
                  Click image for larger version

Name:	Graph.png
Views:	1
Size:	204.9 KB
ID:	1766322
                  ---------------------------------
                  Maarten L. Buis
                  University of Konstanz
                  Department of history and sociology
                  box 40
                  78457 Konstanz
                  Germany
                  http://www.maartenbuis.nl
                  ---------------------------------

                  Comment


                  • #10
                    Thank you Mr Cox and Mr Bouis to you help wih that data and graphs.

                    Comment

                    Working...
                    X