Announcement

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

  • Generating scatter graphs with connected line for minimum / maximum values and multiple categories

    Colleagues,

    I'm interested in generating the following graphics:
    Click image for larger version

Name:	20150117_SRC533.png
Views:	3
Size:	31.4 KB
ID:	678465 Click image for larger version

Name:	20150124_FBC782.png
Views:	2
Size:	93.8 KB
ID:	678466
    I'm more interested in the second one, showing multiple categories. Naturally, I will appreciate any suggestion on how this can be achieved.
    Source: The Economist: 1) Invisible fuel; 2) Getting ‘em young
    Attached Files
    Last edited by Konrad Zdeb; 26 Jan 2015, 02:14.
    Kind regards,
    Konrad
    Version: Stata/IC 13.1

  • #2
    The graphs don't show, so I find it hard to comment.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Marteen,

      Thanks, it happened in past once. I think they will come back, there is some lag with uploading the pictures to the board. They show on mine desktop.
      Kind regards,
      Konrad
      Version: Stata/IC 13.1

      Comment


      • #4
        Attaching as photos
        Kind regards,
        Konrad
        Version: Stata/IC 13.1

        Comment


        • #5
          There is a number of useful range plots. Take a look at:
          Code:
          help twoway rcap
          help twoway rcapsym
          help twoway rspike

          Comment


          • #6
            Credit to The Economist, I think.

            As Svend says, these plots yield to twoway. Various discussions around the subject in http://www.stata-journal.com/sjpdf.h...iclenum=gr0034 and http://www.stata-journal.com/sjpdf.h...iclenum=gr0039

            Comment


            • #7
              Thanks, I think that twoway rcapsym, is what I need. In effect, it will be just a matter of collapsing the data set accordingly.
              Kind regards,
              Konrad
              Version: Stata/IC 13.1

              Comment


              • #8
                Just more question, how to get rid of the gaps at the end of the line:
                Code:
                collapse (min) var1 (max) var2, by(group)
                gen pipe = "|"
                twoway rcapsym var1 var2 simddeciles,  ///
                    horizontal scheme(tufte) ///
                    msymbol(none) mlabel(pipe) ///
                    name(complete_minmax, replace)
                Click image for larger version

Name:	gaps.png
Views:	1
Size:	2.0 KB
ID:	679136
                Kind regards,
                Konrad
                Version: Stata/IC 13.1

                Comment


                • #9
                  Konard, just use the -rcap- instead of rcapsym, and remove the options for msymbol(none) mlabel(pipe)

                  Comment


                  • #10
                    I wouldn't use pipes here. I would use an rcap from itself to itself.

                    Code:
                    sysuse auto, clear
                    set scheme s1color
                    keep if foreign
                    sort mpg
                    gen order = _n
                    labmask order, values(make)
                    twoway spike mpg order , horizontal base(0) pstyle(p1) yla(1/22, val ang(h) noticks) ///
                    || rcap mpg mpg order, horizontal pstyle(p1) xla(0(10)40) legend(off) ytitle("")
                    Click image for larger version

Name:	konrad2.png
Views:	1
Size:	42.8 KB
ID:	679195

                    Comment


                    • #11
                      Thanks very much for the useful suggestions.
                      Kind regards,
                      Konrad
                      Version: Stata/IC 13.1

                      Comment


                      • #12
                        Sorry; I should have explained that labmask is from the Stata Journal. (Second reference in post #6.)

                        Comment


                        • #13
                          I'm just reading about it, very useful piece of software.
                          Kind regards,
                          Konrad
                          Version: Stata/IC 13.1

                          Comment

                          Working...
                          X