Announcement

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

  • Changing to equal spacing between variables in a stripplot (or possibly dotplot)

    Hi,

    My question pertains to -stripplot- from SSC. I have the following stripplot:
    Code:
    stripplot  om_pfe_time, over (which_pH_7_num) mcolor(navy) vertical msize (*1.2) ysize(4) xsize(4) ylab(, nogrid) xlab(, nogrid) ///
    caption("ANOVA p-value = `grpval'" " ", justification(right) pos(1)) bar(lcolor(black%50) ///
    mean(mcolor(black)) level (68)) boffset(0.3)  jitter (5) center
    the variable has observations categorized with the value of 2, 3,4 or 7. As such, one of the graphs will look like:
    Click image for larger version

Name:	Graph.jpg
Views:	1
Size:	28.9 KB
ID:	1745748


    (Please ignore the value `grpval' being blank here. It works well within the full code)

    I would like to get the spacing to be equal between 2, 3, 4, 7 rather than having 7 spaced out where it technically mathematically falls on the x-axis. I understand -bargraph- has an option with bargap() to change the spacing. It appears stripplot does not. I would be willing to change to -dotplot- but it does not appear there is a spacing option for that as well.

    Cross posted to reddit too: https://www.reddit.com/r/stata/comme...ariables_in_a/
    Attached Files
    Last edited by Jay Gold; 06 Mar 2024, 10:47.

  • #2
    Code:
    egen which_pH_7_num2 = group(which_pH_7_num), label
    for an over() variable with underlying values 1 2 3 4 and value labels 2 3 4 7,

    Thanks for telling us about cross-posting, and please flag any closure on Reddit.

    Comment


    • #3
      Thank you Nick. That worked beautifully. So that I can teach myself to fish next time, I looked up what group() is doing here. I see here an explanation here with an example from you:
      https://www.statalist.org/forums/for...mmand-in-stata

      Comment


      • #4
        And thank you for -stripplot- It is fantastic!

        Comment

        Working...
        X