Search
 
SCRIPT & CODE EXAMPLE
 

MATLAB

geom_density_2d

set.seed(1001)
d <- data.frame(x=rnorm(1000),y=rnorm(1000))
getLevel <- function(x,y,prob=0.95) {
    kk <- MASS::kde2d(x,y)
    dx <- diff(kk$x[1:2])
    dy <- diff(kk$y[1:2])
    sz <- sort(kk$z)
    c1 <- cumsum(sz) * dx * dy
    approx(c1, sz, xout = 1 - prob)$y
}
L95 <- getLevel(d$x,d$y)
library(ggplot2); theme_set(theme_bw())
ggplot(d,aes(x,y)) +
   stat_density2d(geom="tile", aes(fill = ..density..),
                  contour = FALSE)+
   stat_density2d(colour="red",breaks=L95)
Comment

PREVIOUS NEXT
Code Example
Matlab :: matlab text subscript 
Matlab :: matlab new line in string 
Basic :: mongodb command remove by _id 
Basic :: git token 
Basic :: theme leaf concatenate 
Basic :: the terminal process failed to launch 
Basic :: whats up 
Basic :: remove button selection outline visual basic 
Elixir :: elixir string to time 
Elixir :: elixir replace string 
Elixir :: phoenix query get first record 
Elixir :: create new project phoenix 
Scala :: scala concatenate list 
Scala :: scala Datetime parse 
Scala :: How to have scalable images using image view xamarin XML 
Actionscript :: iis appcmd stop site 
Excel :: google sheets select item from split 
Excel :: and in excel 
Perl :: split perl 
Pascal :: take console input in pascal 
Pascal :: case of pascal 
Powershell :: To look at a profile to see information about a wifi network 
Clojure :: Clojure whitespace 
Assembly :: openssl public key der to pem 
Assembly :: Z language latex 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: filesaver.min.js cdn 
Javascript :: ajax cdn 
Javascript :: How to get the browser to navigate to a URL in JavaScript 
Javascript :: how to find number in string js 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =