Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Box plot-like graph with mean, 95 percent CI

From   "Sebastian F. Büchte" <>
Subject   Re: st: Box plot-like graph with mean, 95 percent CI
Date   Thu, 8 Mar 2007 09:03:12 +0100


you can achieve what you describe through overlaying two graphs. You
will need a graph of type -scatter- and a graph of type -spike-.

Let's say you dataset contains four variables:

mean_var  ->   variable holding the mean
lcl_var   ->   variable holding the lower confidence limit
ucl_var   ->   variable holding the upper confidence limit
x_var     ->   some variable over which you want to graph the above
              mentioned variables

The apppropiate -graph- command would then be:

twoway                                          ///
    || scatter mean_var x_var, [options]       ///
    || rspike lcl_var ucl_var x_var, [options]  ///
    || , [overall options,eg, legendoptions]

This could of course also be written down differently,eg, just in line
omitting the "||" and the "///", but I just like the very structured
appearance of the above presented.


On 3/8/07, Sebastian Bauhoff <> wrote:
Dear Statalisters,

I need to make a graph that looks like a box plot, but shows the mean
and 95 percent CI.  Basically I want the graph to have a dot for the
mean and a thin like for the CI, and all that for about 10 variables on
the x-axis.  I unsuccessfully tried to get a twoway graph to work using
the code on

Any suggestions very much appreciated!

*   For searches and help try:

*   For searches and help try:

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