Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Boxplot - color coded + cat labels | documenting work round


From   "Allan Reese (Cefas)" <allan.reese@cefas.co.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Boxplot - color coded + cat labels | documenting work round
Date   Thu, 31 Oct 2013 15:25:41 +0000

I drew a standard boxplot with two levels of category and thought it would be cute in color.  I like to avoid separate legends when possible.  After considerable struggle I got there, and *then* RTFM where there is a table of the differences between box with multiple yvars and box with over() groups.  It states "multiple yvars : different color & legend", "over() groups : no colors & axis labels". 

So here's the solution, and a suggestion that when multiple yvars have been reclassified "ascat", you ought to be able to apply the over() subopts!  I'll leave this with my variables, which are length (of animal) compared over sex and age.  The lengths were in one var (to use over() ) and have been split into vars for each sex.

graph box flen mlen,  over( sex, relabel(1 "F" 2 "M") ) nofill legend(off)/// 
                      box( 2, col(pink) )                       box(1, col(blue)) ///
                      marker( 2, ms(oh) mcol(pink) msize(*.8))  marker( 1, ms(th) mcol(blue) msize(*.8)) ///
                      over( age, lab( labsize(*.8) ) gap(*2) ) /// 
                      ylab(5(5)45, angle(0) )   b1(Age)  

Allan



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index