# -*- mode: snippet -*- # name: r image-ggplot # key: r-imgg # -- #+begin_src R :session *R* :results output graphics file :file notebooks/plots/${1:file}.png library(ggplot2) library(scales) data <- $2 theme_set(theme_gray(base_size = 6)) gg <- ggplot(data, aes()) gg <- gg + gg <- gg + scale_x_discrete("X title") gg <- gg + scale_y_continuous("Y title") gg <- gg + ggtitle("") gg <- gg + theme(plot.title = element_text(hjust = 0.5)) gg #+end_src