Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Themes for Presentation with ggplot2 [closed]

Tags:

r

ggplot2

I am currently tasked with making a plot-heavy presentation. Naturally I am going to prepare all my plots in ggplot2. I love Hadley's defaults as they look wonderful both on screen and in print. Typically I also use those defaults for presentations using either a projector or a flatscreen television. However, I was wondering what other options might be out there that would look good in a projection environment? Specifically I was wondering if I might be able to tap into the collective knowledge here to see theme() options other people use for presentation purposes when preparing plots with ggplot2.

What theme settings are recommended for a presentation with projection? How do you implement those settings in ggplot2?

If there are themes repositories you recommend, I'd also appreciate the reference.

like image 991
boshek Avatar asked Oct 18 '22 16:10

boshek


1 Answers

I do actually use this template, changing colors and palettes until I come up with a good set:

  plot +
  theme(
    panel.background = element_rect(fill = "col1", colour = NA), # or theme_blank()
    plot.background = element_rect(fill = "white",colour = NA),
    panel.grid.minor = element_line("col2", size = 0.1), 
    panel.grid.major = element_line("col3", size = 0.1)) +
  theme(axis.text=element_text(size=12, colour="black"),
        axis.title=element_text(size=12,face="bold"))

For example:

p <- qplot(speed, dist, data=cars)
p +
  geom_point(aes(colour=dist)) + 
  scale_colour_gradientn(colours=rainbow(4)) +
  theme(
    panel.background = element_rect(fill = "#21215f", colour = NA), # or theme_blank()
    plot.background = element_rect(fill = "white",colour = NA),
    panel.grid.minor = element_line("#736391", size = 0.1), 
    panel.grid.major = element_line("#ecc6d9", size = 0.1)) +
  theme(axis.text=element_text(size=12, colour="black"),
        axis.title=element_text(size=12,face="bold"))

For a better looking grid, the color in panel.grid.minor may be closer to the one in panel.background. You can change in fact lots of things to get your preferred template.

These links can help:
http://www.cookbook-r.com/Graphs/Colors_(ggplot2)
http://www.w3schools.com/colors/colors_picker.asp
http://sape.inf.usi.ch/quick-reference/ggplot2/themes

enter image description here

like image 86
Mareviv Avatar answered Nov 04 '22 18:11

Mareviv