Paranormal Distribution

October 19, 2015
By

[This article was first published on » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Paranormal Distribution

In case you want to read an influential paper on this matter, you can find it here.

library(ggplot2)
library(gridExtra)

theme_old <- theme(panel.grid.minor = element_blank(),
                   panel.grid.major = element_blank(),
                   panel.background = element_blank(),
                   plot.background = element_rect(fill="#F9F0Ea"),
                   panel.border =  element_blank(),
                   axis.line = element_blank(),
                   axis.text.x = element_blank(),
                   axis.text.y = element_text(colour=NA),
                   # axis.text.y = element_blank(),
                   axis.ticks = element_blank(),
                   axis.title.x = element_blank(),
                   axis.title.y = element_blank(),
# I'm using xkcd fonts, replace or install if you don't have it.
                   text = element_text(size=14, family="xkcd"),
                   axis.line = element_line(colour = "black", linetype = "solid", size = 1),
                   axis.line.y = element_blank(),
                   plot.title = element_text(size=22))
# normal
gplot1 <- ggplot(data.frame(x = c(-3, 3)), aes(x)) + stat_function(fun = dnorm) + labs(title = "Normal Distribution") + theme_old

# The floating dress 
a <- c(-3, -1.5, -0.9, -0.3, 0.6, 1, 1.5, 2, 3)
b <- c(0.004431848, 0.03, 0.0044, 0.03, 0.01, 0.030, 0.0044, 0.015, 0.004431848)

data <- data.frame(a = a, b = b)
c <- c(-0.40, 0.04)
d <- c(0.27, 0.27)
data2 <- data.frame(c = c, d = d)

# paranormal
gplot2 <- ggplot(data, aes(x=a, y=b)) + geom_line()
gplot2 <- gplot2 + stat_function(fun = dnorm) +
  geom_point(data = data2, aes(x=c, y=d), pch=0x30, size=6) +
  geom_point(data = data2, aes(x=c-0.008, y=d-0.006), pch=19, size=1) +
  labs(title = "Paranormal Distribution") + theme_old

grid.arrange(gplot1, gplot2)

To leave a comment for the author, please follow the link and comment on their blog: » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)