Announcement

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

  • Snapshot of key sections of graph (blowing up a portion)

    Hello,

    I'm currently working on a project to determine vaccine timeliness in Fiji by wealth index using Kaplan-Meier curves. Unfortunately, the graphs look very cluttered as the plots are packed closely together. Is it possible to blow up a secton of the graph, particularly a section where the plots diverge, in order to obtain a better visual context of how wealth index affects vaccine timeliness in Fiji?

    These are the commands I am using in order to obtain the graph I currently have:

    stset wmmr2, failure(mmr2)
    sts graph, failure by(windex5) legend(position(6) rows(1) order(1 "Poorest" 2 "Poor" 3 "Middle" 4 "Rich" 5 "Richest")) ///
    xlabel(0(25)150) ///
    xline(72, lcol(navy) lpattern(dash)) ///
    xline(74, lcol(navy) lpattern(dash)) ///
    title(Coverage of MMR2 by wealth index) ytitle(Vaccination coverage (%)) xtitle(Age (weeks))

    wmmr2 is the time to event while mmr2 is the event of interest. windex5 represents wealth index. The vertical dotted lines created by the xline command is only there to mark the "window" of my defined parameters for vaccine timeliness. Attached you will find the graph I can currently create using the commands above. As stated, I would like to improve the resolution of the graph or blow up the section where the plots diverge, sort of like a magnifying glass on that particular section; blowing up the section, of course, means that the other points may be omitted from the graph, which is fine as I will use the original beside it.

    Thanks,
    Ryan
    Attached Files

  • #2
    What about a simple if qualifier to highlight this section?

    Code:
    stset wmmr2, failure(mmr2)
    sts graph if inrange(wmmr2, 65, 75), failure by(windex5) legend(position(6) rows(1) order(1 "Poorest" 2 "Poor" 3 "Middle" 4 "Rich" 5 "Richest")) ///
    xlabel(0(25)150) ///
    xline(72, lcol(navy) lpattern(dash)) ///
    xline(74, lcol(navy) lpattern(dash)) ///
    title(Coverage of MMR2 by wealth index) ytitle(Vaccination coverage (%)) xtitle(Age (weeks))
    Best wishes

    Stata 18.0 MP | ORCID | Google Scholar

    Comment


    • #3
      Detail: There is some small confusion between percent and proportion on the y axis. The numbers run from 0 to 1 but the axis title says %,

      To show 0(25)100 not 0(0.25)1, you can add an option

      Code:
      yla(0 0.25 "25" 0.5 "50" 0.75 "75" 1 "100") 

      Comment


      • #4
        Originally posted by Felix Bittmann View Post
        What about a simple if qualifier to highlight this section?

        Code:
        stset wmmr2, failure(mmr2)
        sts graph if inrange(wmmr2, 65, 75), failure by(windex5) legend(position(6) rows(1) order(1 "Poorest" 2 "Poor" 3 "Middle" 4 "Rich" 5 "Richest")) ///
        xlabel(0(25)150) ///
        xline(72, lcol(navy) lpattern(dash)) ///
        xline(74, lcol(navy) lpattern(dash)) ///
        title(Coverage of MMR2 by wealth index) ytitle(Vaccination coverage (%)) xtitle(Age (weeks))
        Hello,

        I'm afraid that didnt quite do what I wanted to achieve; the graph did not magnify in the are I needed to observe better. Is there another way to achieve this? The are I wish to "magnify" is between 75 to 125 on the x-axis, and 0.5 to 1.0 on the y-axis.

        Thanks,
        Ryan
        Last edited by Ryan Cheong; 24 Oct 2022, 03:17.

        Comment


        • #5
          I don''t ever use sts graph but I fear that you need to generate the variables it is using here if that is possible and graph those results differently.

          Comment


          • #6
            As a partial solution, -st graph- has the options :

            Code:
              tmax(#)                  show graph for t <= #
              tmin(#)                  show graph for t >= #

            Comment


            • #7
              Originally posted by Scott Merryman View Post
              As a partial solution, -st graph- has the options :

              Code:
               tmax(#) show graph for t <= #
              tmin(#) show graph for t >= #
              Hello,

              The tmin/tmax options worked brilliantly in what I was aiming to achieve. The graph magnifies itself according to how centered the variables are. I appreciate all the help given Felix Bittmann , Nick Cox and Scott Merryman

              Thanks,
              Ryan

              Comment

              Working...
              X