Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Themes
- #Checking the theme options
- ?theme
- #We can set a theme as the default, for example
- theme_set(theme_bw())
- #Defining the general colors to avoid hard coding
- fill_color = 'white'
- decoration_color = '#778287'
- main1_color = '#478adb'
- main2_color = '#f206d3'
- #Creare a theme we can apply everywhere
- sandra_theme<-theme_bw() + theme(
- panel.grid.major = element_blank(),
- panel.grid.minor = element_blank(),
- plot.title = element_text(size = 14, hjust = 0.2, color = decoration_color),
- axis.title = element_text(size = 10, hjust = 0.5, color = decoration_color),
- axis.text = element_text(colour = decoration_color, size = 8),
- axis.ticks = element_blank(),
- axis.line = element_line(colour = decoration_color, size=0.3, linetype = "dashed"),
- panel.border = element_blank(),
- panel.grid = element_blank(),
- strip.text = element_text(size = 12, color = decoration_color),
- panel.background = element_blank(),
- strip.background =element_blank(),
- plot.background = element_blank(),
- legend.position="None"
- )
- #Now we set the new defined theme to the default option
- theme_set(sandra_theme)
- #Creare a theme that includes a legend
- sandra_theme2<-theme_bw() + theme(
- panel.grid.major = element_blank(),
- panel.grid.minor = element_blank(),
- plot.title = element_text(size = 14, hjust = 0.2, color = decoration_color),
- axis.title = element_text(size = 10, hjust = 0.5, color = decoration_color),
- axis.text = element_text(colour = decoration_color, size = 8),
- axis.ticks = element_blank(),
- axis.line = element_line(colour = decoration_color, size=0.3, linetype = "dashed"),
- panel.border = element_blank(),
- panel.grid = element_blank(),
- strip.text = element_text(size = 12, color = decoration_color),
- panel.background = element_blank(),
- strip.background =element_blank(),
- plot.background = element_blank(),
- legend.text = element_text(size = 10, hjust = 0.5, color = decoration_color),
- legend.position = c(0.815, 0.27),
- legend.key = element_blank(),
- legend.title = element_blank()
- )
- #Now we set the new defined theme to the default option
- theme_set(sandra_theme2)
- #There is also a dark theme option with black background
- theme_set(dark_theme_gray())
- #Excercise: choose a different dataset and create a basic chart.
- #Then build your own personalised a theme and apply it to the chart.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement