File: sjPlot-themes.Rd

package info (click to toggle)
r-cran-sjplot 2.8.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,596 kB
  • sloc: sh: 13; makefile: 2
file content (154 lines) | stat: -rw-r--r-- 4,372 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sjplot_themes.R
\name{sjPlot-themes}
\alias{sjPlot-themes}
\alias{theme_sjplot}
\alias{theme_sjplot2}
\alias{theme_blank}
\alias{theme_538}
\alias{font_size}
\alias{label_angle}
\alias{legend_style}
\alias{scale_color_sjplot}
\alias{scale_fill_sjplot}
\alias{sjplot_pal}
\alias{show_sjplot_pals}
\alias{css_theme}
\title{Modify plot appearance}
\usage{
theme_sjplot(base_size = 12, base_family = "")

theme_sjplot2(base_size = 12, base_family = "")

theme_blank(base_size = 12, base_family = "")

theme_538(base_size = 12, base_family = "")

font_size(
  title,
  axis_title.x,
  axis_title.y,
  labels.x,
  labels.y,
  offset.x,
  offset.y,
  base.theme
)

label_angle(angle.x, angle.y, base.theme)

legend_style(inside, pos, justify, base.theme)

scale_color_sjplot(palette = "metro", discrete = TRUE, reverse = FALSE, ...)

scale_fill_sjplot(palette = "metro", discrete = TRUE, reverse = FALSE, ...)

sjplot_pal(palette = "metro", n = NULL)

show_sjplot_pals()

css_theme(css.theme = "regression")
}
\arguments{
\item{base_size}{Base font size.}

\item{base_family}{Base font family.}

\item{title}{Font size for plot titles.}

\item{axis_title.x}{Font size for x-axis titles.}

\item{axis_title.y}{Font size for y-axis titles.}

\item{labels.x}{Font size for x-axis labels.}

\item{labels.y}{Font size for y-axis labels.}

\item{offset.x}{Offset for x-axis titles.}

\item{offset.y}{Offset for y-axis titles.}

\item{base.theme}{Optional ggplot-theme-object, which is needed in case multiple
functions should be combined, e.g. \code{theme_sjplot() + label_angle()}.
In such cases, use \code{label_angle(base.theme = theme_sjplot())}.}

\item{angle.x}{Angle for x-axis labels.}

\item{angle.y}{Angle for y-axis labels.}

\item{inside}{Logical, use \code{TRUE} to put legend inside the plotting area.
See also \code{pos}.}

\item{pos}{Position of the legend, if a legend is drawn.
\describe{
  \item{\emph{Legend outside plot}}{
    Use \code{"bottom"}, \code{"top"}, \code{"left"} or \code{"right"}
    to position the legend above, below, on the left or right side
    of the diagram.
  }
  \item{\emph{Legend inside plot}}{
    If \code{inside = TRUE}, legend can be placed inside
    plot. Use \code{"top left"}, \code{"top right"}, \code{"bottom left"}
    and \code{"bottom right"} to position legend in any of these corners,
    or a two-element numeric vector with values from 0-1. See also
    \code{inside}.
  }
}}

\item{justify}{Justification of legend, relative to its position (\code{"center"} or
two-element numeric vector with values from 0-1.}

\item{palette}{Character name of color palette.}

\item{discrete}{Logical, if \code{TRUE}, a discrete colour palette is returned.
Else, a gradient palette is returned, where colours of the requested palette
are interpolated using \code{\link[grDevices]{colorRampPalette}}.}

\item{reverse}{Logical, if \code{TRUE}, order of returned colours is reversed.}

\item{...}{Further arguments passed down to ggplot's \code{scale()}-functions.}

\item{n}{Numeric, number of colors to be returned. By default, the complete
colour palette is returned.}

\item{css.theme}{Name of the CSS pre-set theme-style. Can be used for table-functions.}
}
\description{
Set default plot themes, use pre-defined color scales or modify
  plot or table appearance.
}
\details{
When using the \code{colors} argument in function calls (e.g.
  \code{plot_model()}) or when calling one of the predefined scale-functions
  (e.g. \code{scale_color_sjplot()}), there are pre-defined colour palettes
  in this package. Use \code{show_sjplot_pals()} to show all available
  colour palettes.
}
\examples{
# prepare data
if (requireNamespace("haven")) {
library(sjmisc)
data(efc)
efc <- to_factor(efc, c161sex, e42dep, c172code)
m <- lm(neg_c_7 ~ pos_v_4 + c12hour + e42dep + c172code, data = efc)

# create plot-object
p <- plot_model(m)

# change theme
p + theme_sjplot()

# change font-size
p + font_size(axis_title.x = 30)

# apply color theme
p + scale_color_sjplot()

# show all available colour palettes
show_sjplot_pals()

# get colour values from specific palette
sjplot_pal(pal = "breakfast club")
}

}