Error message

  • Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in book_prev() (line 775 of /home3/gardeoi3/public_html/iamrandom/modules/book/book.module).
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home3/gardeoi3/public_html/iamrandom/includes/common.inc).

Plot: 2D distribution plots

Here are 4 quick ways to plot 2D distributions.  See here for more color options.

library(MASS)   #kde2d() and mvrnorm()
VV=matrix(c(10,8,8,10),2,2)
coef=mvrnorm(10000,c(2,10),VV)
par(mfrow=c(2,2), mar=c(4,4,1,1))
### 1
plot(coef[,1],coef[,2])
### 2
contour(kde2d(coef[,1],coef[,2])) 
### 3
persp(kde2d(coef[,1],coef[,2])) 
### 4 
image(kde2d(coef[,1],coef[,2], n = 100))
box()

File: 
Simple 2D plots