Announcement

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

  • Stripplot

    Hi All,

    I've used stripplot to create my boxplot with individual data points showing as well, which is how I wanted it. However, I'm considering given each box plot a specific colour for each age category (older and younger participants). Is this possible in stata, please?

    The code I used was:

    stripplot phcva, over (agegroup) by(type_of_blur, legend(off) row(1) compact note("")) box(barw(0.3) blc(black)) centre vertical stack jitter(3 3) mc(black) msize(small small) ms (o o) mc (orange_red blue) iqr whiskers() boffset(0.3) yaxis(1 2) yla(-0.2(0.2)1, nogrid ang(h) axis(1) format(%2.1f)) yla(-0.2(0.2)1, nogrid ang(h) axis(2) format(%2.1f)) xla(, labsize(small)) xsize(7) separate (agegroup)
    Attached Files

  • #2
    stripplot is from SSC, as you are asked to explain (FAQ Advice #12).

    What you want is undoubtedly programmable in Stata, but not possible in stripplot as now distributed publicly. It's on my development list.

    I've written recently that jittering is the worst solution for show points that are identical or close, and your example bolsters that prejudice. I recommend trying

    Code:
    stripplot phcva, over (agegroup) by(type_of_blur, legend(off) row(1) compact note("")) box(barw(0.3) blc(black)) centre vertical stack cumul cumprob mc(black) msize(small small) ms (o o) mc (orange_red blue) iqr whiskers() boffset(0.3) yaxis(1 2) yla(-0.2(0.2)1, nogrid ang(h) axis(1) format(%2.1f)) yla(-0.2(0.2)1, nogrid ang(h) axis(2) format(%2.1f)) xla(, labsize(small)) xsize(7) separate (agegroup)
    It's not obvious that you need log scale here. A good reason would be that people customarily report log MAR, whatever that is.

    Comment


    • #3
      Hi Nick, thank you for the code but when I run it, I got this feedback "may not combine cumulate and stack options". I totally get your point on the jittering too, as shown in my plot.

      Anyway, could you please show me the other way to get this plot other than using stripplot?

      Comment


      • #4
        may not combine cumulate and stack options


        Sorry; you should omit stack for what I have in mind. (I couldn't test the code on your data.)

        please show me the other way to get this plot other than using stripplot
        Not today. I did mean "programmable" but did not mean that there is a trivial work-around. You could write your own code from scratch using the principles in https://www.stata-journal.com/articl...article=gr0039 but I won't devote effort to that myself when my goal is at some point to revise stripplot.

        Comment


        • #5
          Got you. I interpreted the "programmable" as "work-around". I've omitted 'stack' but did not produce what I wanted (colour boxes differently for each group group). Thanks anyway.

          Comment


          • #6
            I divided your questions and my comment into two.

            Wanting different colours for boxes. Not supported at present.

            Jittering is messy. Try cumul cumprob instead of jitter(3 3) stack

            Comment

            Working...
            X