Skip to content

Instantly share code, notes, and snippets.

@gghatano
Created January 19, 2014 08:58
Show Gist options
  • Save gghatano/8502210 to your computer and use it in GitHub Desktop.
Save gghatano/8502210 to your computer and use it in GitHub Desktop.
for makky
library(ggplot2)
x <- seq(0,10, by = 0.1)
y <- sin(x)
z <- sin(x) + 1
xyz <- data.frame(x=x, y=y,z=z)
p <- ggplot()
p <- p + geom_line(data = xyz, aes(x = x, y=y)) + geom_line(data = xyz, aes(x=x, y=z))
p <- p + geom_ribbon(data = subset(xyz, x >= 2.5 & x <= 3), aes(fill="blue", x = x, ymin = y, ymax = z))
p <- p + ggtitle("sin(x) ~ sin(x)+1")
p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment