Announcement

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

  • stripplot in the same graph (same axes for both distributions)

    I have a variable VALUE with two distinct groups noted by GROUP (dummy), I would like to write:

    Code:
    stripplot VALUE, over(GROUP)  cumul cumprob bar refline
    to get the plot with the distributions, the confidence intervals, mean, and reference lines of each GROUP in the same graph (that's within the same axes).


    However, the behavior of the option "over" here seems to be the similar as the option "by", as opposed to, for example, in qplot. The option "separate" gets closer by plotting both distributions, but shows a joint reference line, confidence intervals, and mean.

    Is there any way to do what I want?

    Thank you.
    Last edited by Tabare Capitan; 06 Jan 2019, 13:21. Reason: Option separate

  • #2
    stripplot is a community-contributed command from SSC, as you are asked to explain (FAQ Advice #12). You don't provide example data (see same place) or show any graphs you got (ditto).

    It is not correct, however, that over() and by() work the same way and I am at a loss to know why you make that claim. The difference lies in presenting within one panel and within two panels. Here are two simple examples:

    Code:
    sysuse auto, clear 
    
    stripplot mpg, over(foreign) vertical cumul cumprob bar refline height(0.5) xla(, noticks) yla(, ang(h)) 
    
    stripplot mpg, by(foreign) vertical cumul cumprob bar refline height(0.5) xla(, noticks) yla(, ang(h))
    Click image for larger version

Name:	capitan1.png
Views:	1
Size:	35.7 KB
ID:	1477573


    Click image for larger version

Name:	capitan2.png
Views:	1
Size:	40.2 KB
ID:	1477574

    Comment


    • #3
      Thanks for the reply Nick. I will clarify.

      I meant that the option by and the option over are similar in that they both plot the distributions using a different x-axis. For example, using this dataset:

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input float valinfoim byte endow
      -.005 1
       1.75 0
       1.75 1
      -.005 0
       .005 1
       1.75 0
       .875 1
       .005 0
       .005 1
       .875 0
       -.13 0
       1.75 1
       .875 1
      -.875 0
       .625 0
       .005 0
       .875 1
      -1.25 1
       .005 1
          4 0
      end
      When I use the option over, I get:

      Code:
      #delimit ;
      
      stripplot valinfoim,                                                            
                      over(endow)                                                 
                      cumul cumprob                                       
                      bar(lcolor(black) lcolor(black))  
                      refline(lpattern(dash))                  
                      title("TITLE")                                                    
                      legend(off)                                             
                      vertical                                                             
                      height(0.8)                                                       
                      boffset(0)                                                             
                      yla(, ang(h))                                                     
                      xtitle("")                                                            
                      xla(,                                                                 
                      ang(-.001) labgap(2) noticks)    
      ;
      Click image for larger version

Name:	exampleBy.png
Views:	1
Size:	11.3 KB
ID:	1477783



      If I use the option by, I get:

      Code:
      #delimit ;
      
      stripplot valinfoim,                                                           
                      by(endow)                                                       
                      cumul cumprob                                              
                      bar(lcolor(black) lcolor(black))                        
                      refline(lpattern(dash))                                     
                      title("TITLE")                                                   
                      legend(off)                                                      
                      vertical                                                           
                      height(0.8)                                                      
                      boffset(0)                                                            
                      yla(, ang(h))                                                     
                      xtitle("")                                                            
                      xla(,                                                                  
                      ang(-.001) labgap(2) noticks)          
      ;
      Click image for larger version

Name:	exampleOver.png
Views:	1
Size:	14.3 KB
ID:	1477784



      But I would like something closer to what I get when using the option separate:

      Code:
      #delimit ;
      
      stripplot valinfoim,                                                             
                      separate(endow)                                              
                      cumul cumprob                                                 
                      bar(lcolor(black) lcolor(black))                          
                      refline(lpattern(dash))                                       
                      title("TITLE")                                                    
                      legend(off)                                                        
                      vertical                                                              
                      height(0.8)                                                        
                      boffset(0)                                                              
                      yla(, ang(h))                                                      
                      xtitle("")                                                             
                      xla(,                                                                   
                      ang(-.001) labgap(2) noticks)     
      
      ;
      Click image for larger version

Name:	exampleSeparate.png
Views:	1
Size:	11.3 KB
ID:	1477785


      However, in the graph above, I get one bar and one reference line for the combined data, instead of one bar for each category. I understand that this is the intended behavior of the program, but I was just wondering if there is any easy way get one bar for each category and to plot the two distributions together.

      Thanks again.



      Comment


      • #4
        Sorry, but that's not supported and not part of any development intentions.

        Comment

        Working...
        X