Skip to content

Instantly share code, notes, and snippets.

@alstat
Last active September 15, 2016 06:36
Show Gist options
  • Select an option

  • Save alstat/9d4f7f19152dabe9e89d to your computer and use it in GitHub Desktop.

Select an option

Save alstat/9d4f7f19152dabe9e89d to your computer and use it in GitHub Desktop.
library(ggplot2)
# ggplot theme to be used
plotTheme <- function() {
theme(
panel.background = element_rect(
size = 3,
colour = "black",
fill = "white"),
axis.ticks = element_line(
size = 2),
panel.grid.major = element_line(
colour = "gray80",
linetype = "dotted"),
panel.grid.minor = element_line(
colour = "gray90",
linetype = "dashed"),
axis.title.x = element_text(
size = rel(1.2),
face = "bold"),
axis.title.y = element_text(
size = rel(1.2),
face = "bold"),
plot.title = element_text(
size = 20,
face = "bold",
vjust = 1.5)
)
}
# Plot the image
ggplot(data = imgRGB, aes(x = x, y = y)) +
geom_point(colour = rgb(imgRGB[c("R", "G", "B")])) +
labs(title = "Original Image: Colorful Bird") +
xlab("x") +
ylab("y") +
plotTheme()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment