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,
showTableSummary = FALSE)
# Use classic-theme as base. you may need to
# load the ggplot2-library.
library(ggplot2)
sjp.setTheme(base = 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,
showTableSummary = FALSE,
labelPos = "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, taken from tutorial
# http://minimaxir.com/2015/02/ggplot-tutorial/
sjp.setTheme(theme = "538",
geom.alpha = 0.8)
library(ggplot2) # for custom base-line
sjp.frq(efc$e42dep,
geom.color = "#c0392b",
expand.grid = TRUE,
printPlot = FALSE)$plot +
geom_hline(yintercept = 0,
size = 0.5,
colour = "black")
Run the code above in your browser using DataLab