library(sjmisc)
data(efc)
# set sjPlot-defaults, a slightly modification
# of the ggplot base theme
sjp.setTheme()
# legends of all plots inside
sjp.setTheme(legend.pos = "top left",
legend.inside = TRUE)
sjp.xtab(efc$e42dep, efc$e16sex)
# Use classic-theme. you may need to
# load the ggplot2-library.
library(ggplot2)
sjp.setTheme(theme = theme_classic())
sjp.frq(efc$e42dep)
# adjust value labels
sjp.setTheme(geom.label.size = 3.5, geom.label.color = "#3366cc",
geom.label.angle = 90)
# hjust-aes needs adjustment for this
update_geom_defaults('text', list(hjust = -0.1))
sjp.xtab(efc$e42dep, efc$e16sex, vjust = "center", hjust = "center")
# Create own theme based on classic-theme
sjp.setTheme(base = theme_classic(), axis.linecolor = "grey50",
axis.textcolor = "#6699cc")
sjp.frq(efc$e42dep)
# use theme pre-set
sjp.setTheme(theme = "538", geom.alpha = 0.8)
library(ggplot2) # for custom base-line
sjp.frq(efc$e42dep, geom.color = "#c0392b", expand.grid = TRUE,
prnt.plot = FALSE)$plot +
geom_hline(yintercept = 0, size = 0.5, colour = "black")
# mimic R base theme
sjp.setTheme("rbase")
sjp.frq(efc$e42dep, ylim = c(0, 400), axis.title = "",
title = get_label(efc$e42dep))
Run the code above in your browser using DataLab