Skip to content

Instantly share code, notes, and snippets.

@gghatano
Created January 19, 2014 10:23
Show Gist options
  • Select an option

  • Save gghatano/8502924 to your computer and use it in GitHub Desktop.

Select an option

Save gghatano/8502924 to your computer and use it in GitHub Desktop.
for makky2
library(ggplot2)
# make dataframe
x <- seq(0,3, by = 0.1)
y <- x^2
xy <- data.frame(x = x, y = y)
# plot
p <- ggplot()
p <- p + geom_line(data = xy, aes(x = x, y = y))
p <- p + geom_hline(yintercept = c(0,2^2))
p <- p + geom_vline(xintercept = c(0,2))
p <- p + geom_ribbon(data = subset(xy, x <= 2), aes(x = x, ymin = y, ymax = 4), alpha = 0.2)
p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment