Announcement

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

  • Cross-hairs plot

    Hi everybody

    I am trying to make a cross-hair plot of data on surgical outcomes, but I cannot figure out how to make the graphs.

    For multiple surgical centers I have 2 different outcomes with a upper and lower confidence interval, i.e.

    outcome1, 1lci, 1uci
    outcome2, 2lci, 2uci

    I would like to make a plot that looks something like the graph below with the cross-hair and different color or label for each center.


    I can't figure out how to do this, but I may a simple problem of me just not knowing the correct term to search for (which might not be cross-hair)!

    Best regards
    Mads Damkjaer



  • #2
    Code:
    help tw scatter
    help tw rcap

    Comment


    • #3
      Code:
      // create some example data
      clear
      input i x xlb xub y ylb yub
      1 .5 .4 .65 .3 .25 .4
      2 .3 .1 .5 .8 .6 .85
      end
      
      // make the graph
      twoway scatter y x ,                ///
                  mlabel(i)               ///
                  msymbol(Oh)             ///
                  mcolor(black)           ///
                  mlabpos(2)||            ///
             rcap ylb yub x,              ///
                  lcolor(black) ||        ///
             rcap xlb xub y,              ///
                  lcolor(black)           ///
                  horizontal              ///
                  legend(off)             ///
                  scheme(s1mono)          ///
                  ylab(0(.25)1, angle(0)) ///
                  xlab(0(.25)1)
      Click image for larger version

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

      Comment


      • #4
        Brilliant Maarten

        Comment


        • #5
          Thank you for the question and coding. Question - how do we add arrows for the long CIs?

          Comment


          • #6
            See also diplot from SSC.

            Comment


            • #7
              Click image for larger version

Name:	Graph.jpg
Views:	1
Size:	5.7 KB
ID:	1671773


              Thank you Nick, I just checked this package. It seems good, but my problem is with the long CIs not all of them. I also would need to use colours.
              I've been following with Marteen code. It seems good so far, but my problem is with the long CIs. I still need to "scatter the dots" but it's not working out.
              Last edited by Naseem Alkhoury; 01 Jul 2022, 10:32.

              Comment

              Working...
              X