The user can either specify a variable for the standard error
(seVar
),
or directly the variables for the minimum and maximum values for the error
bars (minVar
, maxVar
).
subjectProfileSummaryPlot(
data,
xVar = NULL,
xLab = getLabelVar(xVar, labelVars = labelVars),
xAxisExpand = waiver(),
xGap = NULL,
xGapDiffNew = NULL,
meanVar = "statMean",
seVar = if ("statSE" %in% colnames(data)) "statSE",
minVar = NULL,
maxVar = NULL,
yLab = paste(c(sub("^stat", "", meanVar), if (!is.null(minVar) & !is.null(maxVar)) {
paste0("(", sub("^stat", "", minVar), ", ", sub("^stat", "", maxVar), ")")
} else
if (!is.null(seVar)) paste("+-", sub("^stat", "", seVar))), collapse = " "),
facetVar = NULL,
facetScale = "free_y",
colorVar = NULL,
colorLab = getLabelVar(colorVar, labelVars = labelVars),
colorPalette = NULL,
labelVars = NULL,
useLinetype = TRUE,
linetypePalette = NULL,
useShape = TRUE,
shapePalette = NULL,
jitter = NULL,
title = NULL,
caption = NULL,
yTrans = NULL,
yLim = NULL,
xLim = NULL,
yAxisExpand = c(0.05, 0.05),
yLimExpand = NULL,
xAxisLabs = NULL,
sizePoint = GeomPoint$default_aes$size,
sizeLine = GeomLine$default_aes$size,
sizeLabel = GeomText$default_aes$size,
widthErrorBar = GeomErrorbar$default_aes$width,
tableText = NULL,
tableTextFontface = 1,
tableHeight = 0.1,
tableYAxisLabs = !is.null(colorVar),
tablePlotMargin = unit(0, "pt"),
label = FALSE,
labelPadding = unit(1, "lines"),
byVar = NULL,
hLine = NULL,
hLineColor = "black",
hLineLty = "solid",
vLine = NULL,
vLineColor = "black",
vLineLty = "solid",
style = "report",
fontname = switch(style, report = "Times", presentation = "Tahoma"),
fontsize = switch(style, report = 8, presentation = 10),
themeFct = switch(style, report = theme_classic, presentation = theme_bw),
themeIncludeVerticalGrid = TRUE,
ggExtra = NULL,
legendPosition = ifelse(!is.null(tableText), "none", "bottom"),
...
)
ggplot
object or list of such
objects of byVar
is specified.
Data.frame with summary statistics to represent in the plot,
e.g. a summaryTable
object.
String, variable of data
with variable for the x-axis.
String with label for the xVar
.
Object passed to the 'expand' parameter of:
scale_x_continuous
,
(waiver
by default).
(optional) Numeric vector of length 2 for which
a gap should be created in the x-axis.
Only available if xVar
is specified and a numeric variable.
Records with xVar
within xGap
are filtered from the plot,
vertical lines are included at the min/max of the gap,
and the gap is represented as '//' in the x-axis of the plot.
Numeric vector of length 2 with new range
of the xGap
. If not specified, the minimum difference between
consecutive x elements in the data is used.
String, variable of data
with the mean variable.
String, variable of data
with the standard error.
String, variables of data
with minimum and
maximum value for error bar.
If both are specified, seVar
is ignored.
String with label for the y-axis.
If different labels should be used for different elements of
byVar
variable, the vector should be named
with each corresponding element (collapsed with '.' if multiple).
Character vector, variable(s) of data
for facetting.
String with type of scale used for facetting, 'free_y' by default (fixed scale in the x-axis and free in the y-axis).
String, variable of data
for coloring.
String, label for colorVar
, used in the legend.
(named) Vector with color palette.
Named string with variable labels (names are the variable code).
Logical, if TRUE (FALSE by default) use also linetype
to differenciate the variable specified via colorVar
in the mean line.
Vector with linetype(s), in case useLinetype
is TRUE.
Logical, if TRUE (by default) colorVar
is also used for the shape.
Named vector with shape palette for colorVar
.
Numeric with jitter for the x-axis, only used if colorVar
specified.
String with title for the plot.
If different labels should be used for different elements of
byVar
variable, the vector should be named
with each corresponding element (collapsed with '.' if multiple).
String with caption for the plot, NULL by default.
(optional) String with transformation for the y-axis.
Currently only 'log10' (or NULL, default) is available.
In case error bars go in the negative, their values are set to a 'small enough' value for plotting:
min(data)/10
or yLim[1]
if yLim
is specified.
Vector of the length 2 with limits for the y-axis.
Vector of the length 2 with limits for the x-axis.
Expansion constants for the limits for the y-axis.
See the documentation of the expand
parameter of the
scale_y_continuous
function
for the available values for this parameter.
This parameter is deprecated, use yAxisExpand
instead.
(optional) Named character vector with labels for the x-axis.
Size for the point.
Size for the line linking means and error bars.
Size for the label, only used if label
is not NULL.
Numeric vector of length 1 with width of error bar.
(optional) Character vector with colname of data
or expression from colnames of data
to be represented in
the table below the plot.
By default, no table is displayed.
Font face for the text included in the table.
Numeric of length 1 with height for the table.
Logical, if TRUE (by default)
the labels of the colorVar
are included
in the y-axis of the table.
Margin between the plot and the table,
expressed as unit
, 0 by default.
Logical or expression or list of expression.
Points are labelled with meanVar
if set to TRUE,
or with the specified expression if label
is an expression.
If a list is specified, 'textLabel' (required)
should contain expression to extract label,
and 'textHjust' and 'textVjust' (optional) may contain expression
specifying horizontal and vertical adjustment of the label.
Amount of padding (space) between each point
and its label
, 1.5 lines by default.
See parameter point.padding
of the
geom_text_repel
function.
Variable(s) of data
for which separated plot(s)
should be created.
(optional) numeric with y-intercept of line(s) to be added.
If different thresholds should be used for different elements of the
byVar
or facetVar
variables, the vector should be named
with each corresponding element (collapsed with '.' if multiple).
String with color for hLine
, 'black' by default.
String with linetype for hLine
, 'solid' by default.
(optional) numeric with x-intercept of line(s) to be added.
If different thresholds should be used for different elements of the
byVar
or facetVar
variables, the vector should be named
with each corresponding element (collapsed with '.' if multiple).
String with color for vLine
, 'black' by default.
String with linetype for vLine
, 'solid' by defaul
String with subject profile style.
This affects the parameters: fontname
, fontsize
and themeFct
.
String with font name,
by default 'Times' if style
is 'report' and
'Tahoma' if style
is 'presentation'.
Numeric vector of length 1 with font size,
by default 8 if style
is 'report' and
10 if style
is 'presentation'
Function with ggplot2 theme,
by default theme_classic
if style
is 'report' and
theme_bw
if style
is 'presentation'.
Logical, if TRUE (by default)
include theme vertical grid lines (if present in themeFct
).
Extra ggplot
call of function generating such call(s)
to be added in main plot.
Multiple calls are set via a function, e.g.
ggExtra = function(gg){gg + geom_vline(...) + geom_hline(...)}
.
If different calls should be used for different elements of the
byVar
variable, the vector should be named
with each corresponding element (collapsed with '.' if multiple).
String with legend position.
By default, 'bottom' of tableText
is not specified,
'none' otherwise.
Additional parameters for geom_text_repel
or
geom_text
used for the label
.
Laure Cougnaud