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

  • #16
    Dear Nick Cox ,
    I would kindly appreciate your urgent help with a tiny yet very important and urgent issue for me:

    For some reason my Stripplot is not applying the valuelabel option on my y-axis, my code:

    Note that Treatment is binary(0,1) and h10aCPecon is a nominal variable which indicates if the investment was done in any 4 economic sectors:
    label def h10aCPeconx 1 "SER" 2 "TUR" 3 "AGR" 4 "IND", replace
    label val h10aCPecon h10aCPeconx

    stripplot h10aCPecon, over(Treat) refline(lcolor(erose)) reflevel(mean) tufte(lcolor(eltgreen) mcolor(red) ms(sh)) ytitle(, size(3)) ysc(titlegap(+4) outergap(-3)) cumul cumprob centre vertical height(0.2) yla(0/4, valuelabel ang(h)) xla(, noticks)

    Note that I even tried adding more vsc outergap for the ylabel. But the Stripplot is showing 1 2 3 4 in the y-axis instead of the desired sectors SER TUR AGR IND

    Please note that I just updated the Stripplot with . ssc inst stripplot,replace

    Thank you very much in advance!


    • #17
      Claims of urgency are not a good idea. There is a hint about this in the FAQ Advice.

      A bigger deal is that I can't play with your problem without example data. If I set up a parallel problem

      sysuse auto, clear 
      label def rep78 1 "abysmal" 2 "appalling" 3 "adequate" 4 "admirable" 5 "awesome", replace
      label val rep78 rep78 
      stripplot rep78, over(foreign) refline(lcolor(erose)) reflevel(mean) tufte(lcolor(eltgreen) mcolor(red) ms(sh)) ///
      ytitle(, size(3)) ysc(titlegap(+4) outergap(-3)) cumul cumprob centre vertical height(0.2) yla(1 "abysmal" 2 "appalling" 3 4 5,  ang(h)) xla(, noticks)
      I can confirm that stripplot loses sight of any value labels. There are circumstances in which this is a feature. but you need that not to happen and the quickest work-around is to specify what you want on the fly, as I've done for two categories in the last command.


      • #18
        Nick Cox , what if the reference line was drawn last instead of first? With my own data, I'm finding that many times the reference line is obscured by the markers because it's drawn first. I attached a close example of what I'm seeing using the auto dataset. Second attachment is what it would look like if the reference line was drawn last.

        sysuse auto, clear
        xtile mpg_p50 = mpg
        stripplot price, over(foreign) refline(lcolor(red)) reflevel(median) vertical ///
        xscale(range(-0.5 1.5)) width(200) height(0.2) stack center separate(mpg_p50) ///
        msymbol(O) mcolor(green maroon) legend(off)
        Attached Files


        • #19

          is there a way to circumvent the limitation of 1 over option? One possibility would be to superimpose another stripplot, but plot/addplot/twoway do not work as stripplot isn't a twoway graph.
          Essentially, I would like to turn very busy box graphs with 2 over dimensions into more readable stripplot (preferred) or dotplot :it seems that using shading, I can approximate graphically a median and IQR without actually indicating it. Even changing colour within one over covariate according to the other (as it appears to be possible in the above examples) would work.
          Any other solution is also welcome. These are matrices of generally 5 to 70 ish (first over covariate) x 2 ish (second over covariate) x whatever number of study participants (say 30ish to 3000ish). When I want to show variability, I use heatmaps with 2 dimensions etc, but sometimes it is preferable to show the three dimensions and emphasize the central tendency and the spread of the dependent variable

          I'm trying to make up a dataset but let me see if I can find something suitable in the classic BP, car, etc data. Will edit

          Thank you so very much


          • #20
            Incidentally, I can't seem to make the cat axis label options work with stripplot ...

            sysuse bplong, clear
            stripplot bp*, over(sex, ) vertical msize(tiny) mcolor (navy%2 )

            works normally

            stripplot bp*, over(sex, label(labsize(small) angle(vertical))) vertical msize(tiny) mcolor (navy%2 )
            over() does not contain a valid varname


            • #21
              Nazzarena #20 #19’The name over() is stolen from its use in other Stata commands but in no other sense Is it a gateway to over() as implemented for say graph bar, graph hbar or graph dot. Indeed stripplot is a wrapper for graph twoway.

              Mark Horowitz it’s a point of principle with me that data elements are drawn last. You can tune the balance by using open markers or smaller markers or thicker lines. See earlier in the thread for other uses of reference lines,


              • #22
                Dear Nick Cox
                How do you add the whisker at 5% and 95% for this graph? Thanks very much for your help. Laura
                Last edited by Laura Cordova; 10 Nov 2023, 11:39.


                • #23
                  The graph in #22 was in #1 but without the syntax, which would be something close to

                  sysuse auto, clear
                  stripplot price, over(foreign) pctile(5) box(barw(0.08)) cumul vertical boffset(-0.1) xla(, noticks) refline reflevel(median) yla(0(2500)15000) subtitle(whiskers to 5 and 95% points) ytitle(Price (USD))


                  • #24
                    Thanks for that! laura