Statalist


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

st: Plotting the MEAN on a box plot


From   "Neil Martin" <nmartin@hsph.harvard.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Plotting the MEAN on a box plot
Date   Mon, 23 Feb 2009 06:14:07 -0500

**Posting to this list is new for me.  I thought I had submitted this question two days ago but I can't find it in the archive... That is to say, sorry if this is a repost.**

I am interested in producing a figure of vertical box plots comparing groups of four variables across three strata and then across two more strata.  I'm very happy with the figure I've managed to produce this way and I would now like to add the mean values superimposed on the boxes themselves.  I know this topic has been covered previously on this listserve: (http://www.stata.com/statalist/archive/2003-06/msg00080.html) but I'm having trouble interpreting what the final answer was on this issue.  It seemed like the implications were 1) try to overlay a figure of the means, or 2) use another software package.  All things being equal, I would very much like to use the figure I have now but I don't fully understand how I would overlay the means.

I am using version 10.1 on the Mac. 

I'm not sure how much this will help things but I am plotting my variable (dose) according to first a type data collected (data1), second over the type of treatment plan (plan1), and finally over a broad target criteria (internal).  My code is as follows:

graph box dose if oar==1, over(data1, gap(50)) over(plan1, gap(300)) over(internal, gap(500)) box(1, fcolor(dknavy)) box(2, fcolor(forest_green) lcolor(forest_green)) box(3, fcolor(dkorange) lcolor(dkorange)) box(4, fcolor(maroon) lcolor(maroon)) medtype(marker) medmarker(msize(vtiny) msymbol(smplus)) marker(1, mcolor(dknavy)) marker(2, mcolor(forest_green)) marker(3, mcolor(dkorange)) marker(4, mcolor(maroon)) ytitle(% of total volume) caption(bladder) legend(rows(1)) scheme(s2color8) xsize(9) ysize(7)

Notably, I can also produce a dot plot of the means according to the same grouping as above using:

graph dot (mean) dose if oar==1, over(data1, gap(50)) over(plan1, gap(300)) over(internal, gap(500))

But the figure is oriented horizontally and I don't know the command which allows me to overlay the two (if such a thing is even possible).

Thanks very much in advance for any assistance.

Neil

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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index