[R] plotting standard deviation of multivariate normal distribution (preferred in rgl package)

drflxms drflxms at googlemail.com
Fri Mar 2 14:46:18 CET 2012

Dear R colleagues,

for a statistics tutorial I want to develop a nice 3d-graphic of the
well known target comparison/analogy of accuracy and precision (see i.e.
http://en.wikipedia.org/wiki/Accuracy_and_precision for a simple hand
made 2d graphic).

The code for a really beautiful graphic is already provided as
demo(bivar) in the rgl package (for a picture see i.e
http://rgl.neoscientists.org/gallery.shtml right upper corner).

Now I'd like to add the standard deviation to the 3d plot. Unfortunately
I couldn't figure out how to do that.

What I did so far is:

Assuming you have executed the code of the demo mentioned above you can
plot a 2d scatter plot of the data ("the shots on the target") via a simple


and add a contour plot via

contour(denobj, nlevels=8)

So the contour levels are about what I am looking for but...

1. how to make contour plot display exactly standard deviations as
contours and not arbitrary levels?

2. how to project the standard deviation contours on the 3d surface?

Probably there are (as always) lots of different solutions as well.
Id' appreciate any kind of help very much!

Greetings from Munich, Felix

More information about the R-help mailing list