


Legend.text = element_text(color = "white")Ĭoursera - Online Courses and Specialization Data science Legend.title = element_text(color = "white"), Legend.key = element_rect(color = "gray", fill = "black"), Legend.background = element_rect(fill = "black", color = NA), Panel.background = element_rect(fill = 'black'), Plot.background=element_rect(fill = "gray"), Use the dark theme function - theme_dark(): sp + theme_dark()Ĭreate a ggplot with a black background: sp + theme( Stat_smooth(aes(color = Species, fill = Species), Geom_point(aes(color = Species, shape = Species))+ Start by creating a simple scatter plot: sp <- ggplot(iris, aes(Sepal.Length, Sepal.Width))+ For example to remove the major grid lines for the x axis, use this: p + theme( = element_blank()). To remove a particular panel grid, use element_blank() for the corresponding theme argument. Modfify a rectangle element background fill, as well as, the border color, size and linetype. element_rect(fill, color, size, linetype).= element_line() # Vertical major grid lines = element_line(), # Vertical minor grid lines = element_line(), # Horizontal major grid lines = element_line(), # Vertical major grid lines Panel.border = element_rect(), # Border around plotting area. Panel.background = element_rect(), # Background of plotting area

Plot.background = element_rect(), # Background of the entire plot Key ggplot2 theme options to modify the plot panel and background: theme(
