Bookmark and Share

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

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

RE: st: 3D bar plot

From   Nick Cox <>
To   "''" <>
Subject   RE: st: 3D bar plot
Date   Wed, 18 Jan 2012 10:53:44 +0000

While I am naturally happy that Maarten thinks my -tabplot- worth recommending, and it is as far as I know the closest to what is being asked for, on a second take I am a bit puzzled by the original question. 

Panel means and standard deviations are in general real-valued and I would not expect many exact ties. So, a scatter plot of panel SD and panel mean sounds more natural. (Jittering is available if there are ties.) Some people are keen on bubble plots. 

If the number of panels is enormous, -tabplot- might well look like a mess even after some binning, and some kind of heat map may be more advisable. 


Maarten Buis

On Wed, Jan 18, 2012 at 7:33 AM, Ning Li <> wrote:
> What is the command for drawing a 3D bar plot? by 3D bar plot it is meant -
> Suppose our data set is {(x,y,z)}={(8.3, 2.3, 2), (9.2, 1.8, 4), (7.1, 0.9, 5)}
> For each point in the (x,y) plate, a vertical bar with height that equals the corresponding z value is drawn. ie., in the position (x,y)=(8.3,2.3), a vertical bar of length 2 is presented, ....
> When x and y represent, respectively, within-person mean and within-person standard deviation, and z the frequency of the corresponding pattern, this plot should give a graphic summary of the panel data.

I would look at Nick Cox's -tabplot- (see: -ssc descr tabplot-). It is
not 3D, but I think it does what you want to do. Here is an example:

*---------- begin example ---------------
webuse union, clear
xtset idcode year
bys id: egen m = mean(union)
bys id : egen sd = sd(union)
bys id (year) : gen byte mark = _n == 1

// we need some rounding in this dataset
// to get a readable graph
replace m  = round(100*m ,10)
replace sd = round(100*sd,10)

// the graph
tabplot m sd if mark
*----------- end example ----------------
(For more on examples I sent to the Statalist see: )

*   For searches and help try:

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