Announcement

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

  • Stripplot; using different symbols when using ,over(group)

    Dear Listers

    I have been working with stripplot (SCC) all day, and like how it has turned out. For sake of uniformity, i would like to use the same symbols for the two groups in my study through out my presentation. Some of the data is presented as twoway scatters and there i have no difficulty controlling the msymbols for each group. My graph code, looks like this. Group is 0 or 1.

    Code:
    stripplot var1, over(group) stack vertical height(.8) width(0.01) center ysize(1.1) //
    lab(0.5(0.5)1.6, nogrid)//
    graphregion(color(white)) bgcolor(white) ytitle("some title)") //
    title("title", color(black) box bexpand fcolor(white)) 
    xsize(1) xlabel(0 "Reference" 1 "Case group") xtitle("") mcolor(black) msymbol(Oh) box iqr refline
    now I would like it to be: msymbol(Oh) if group==0, and msymbol(O) if group==1

    hope you can help.

    Lars

  • #2
    You need the separate() option too.

    Comment


    • #3
      Thank you Nick Cox, as allways it worked like a charm. I did not know that you could use both the over() and separate() in the same graph.

      Code:
      *for simplicity*
      stripplot var1, over(group) seperate(group) stack vertical height(.8) width(.01) center msymbol(Oh O) mcolor(black black) box iqr refline

      Comment


      • #4
        Good, but people should note the spelling separate().

        There are two examples in the help combining over() and separate(). What is not explicit is that you can use the same variable in each.

        Last edited by Nick Cox; 29 Jan 2020, 02:01.

        Comment


        • #5
          i wish i could edit for more than an hour, or at least learn how to spell.

          even though the help files are useful, i find that sometimes that there are combinations unique to my needs that i cannot get from the help files but from the statalist.org.

          Comment


          • #6
            There is a story there. separate is a hard word to spell even for people whose first language is English. For many years I too often puzzled about seperate and separate.

            Back in the day we added a separate command to Stata and could foresee that spelling it correctly would be a problem for many users. So, we implemented a seperate command too, and its entire function is to call up separate. Since doing that I have no problem with the spelling.

            It's a serious point about stripplot that the power lies in the options. The defaults aren't exciting. It's an ambition of mine to write a paper about the command. Meanwhile, a smaller ambition is just to bundle all the examples into a .do file distributed with the other files, so that people can run that and see examples.

            Comment


            • #7
              The do as part of graph addons would be fantastic, as that would make it easy to see what the different options do in fact do.

              Comment


              • #8
                I have continued to work with the code as described above, but i would like to make it evenmore complex, by adding sex into the mix.
                But when i try to put them into over (sex group) or separate (sex group) i am not allow to.

                What i want is to be able to give sex different marker symbols within the same graph.

                Hope this can be done.

                Comment


                • #9
                  Not with the code as it stands. You could


                  Code:
                  egen which = group(sex group) , label
                  and work from there.

                  Comment

                  Working...
                  X