Usage
sjp.scatter(x = NULL, y = NULL, grp = NULL, title = "", legend.title = NULL, legend.labels = NULL, dot.labels = NULL, axis.titles = NULL, wrap.title = 50, wrap.legend.title = 20, wrap.legend.labels = 20, geom.size = 2, label.size = 3, geom.colors = NULL, show.axis.values = TRUE, fit.line.grps = FALSE, fit.line = FALSE, show.ci = FALSE, fitmethod = "lm", jitter.dots = FALSE, emph.dots = FALSE, auto.jitter = TRUE, jitter.ratio = 0.15, show.rug = FALSE, show.legend = TRUE, facet.grid = FALSE, prnt.plot = TRUE)
Arguments
x
vector indicating the x positions. If not specified (i.e. if
NULL
), a range from 1 to length of y
is used to spread the
dots along the x axis.
y
vector indicating the y positions. If not specified (i.e. if
NULL
), a range from 1 to length of x
is used to spread the
dots along the y axis.
grp
grouping variable. If not NULL
, the scatter plot will be grouped. See
'Examples'. Default is NULL
, i.e. not grouping is done.
title
character vector, used as plot title. Depending on plot type and function,
will be set automatically. If title = ""
, no title is printed.
legend.title
character vector, used as title for the plot legend.
legend.labels
character vector with labels for the guide/legend.
dot.labels
character vector with names for each coordinate pair given
by x
and y
, so text labels are added to the plot.
Must be of same length as x
and y
.
If dot.labels
has a different length, data points will be trimmed
to match dot.labels
. If dot.labels = NULL
(default),
no labels are printed.
axis.titles
character vector of length one or two, defining the title(s)
for the x-axis and y-axis.
wrap.title
numeric, determines how many chars of the plot title are displayed in
one line and when a line break is inserted.
wrap.legend.title
numeric, determines how many chars of the legend's title
are displayed in one line and when a line break is inserted.
wrap.legend.labels
numeric, determines how many chars of the legend labels are
displayed in one line and when a line break is inserted.
geom.size
size resp. width of the geoms (bar width, line thickness or point size,
depending on plot type and function). Note that bar and bin widths mostly
need smaller values than dot sizes.
label.size
Size of text labels if argument dot.labels
is used.
geom.colors
user defined color for geoms. See 'Details' in sjp.grpfrq
. show.axis.values
logical, whether category, count or percentage values for the axis
should be printed or not.
fit.line.grps
logical, if TRUE
, a fitted line for each group
is drawn. See fitmethod
to change the fit method of the fitted lines.
fit.line
logical, if TRUE
, a fitted line for the overall
scatterplot is drawn. See fitmethod
to change the fit method
of the fitted line.
show.ci
logical, if TRUE
, depending on type
, a confidence
interval or region is added to the plot.
fitmethod
By default, a linear method ("lm"
) is used for fitting
the fit lines. Possible values are for instance "lm"
, "glm"
,
"loess"
or "auto"
.
jitter.dots
logical, if TRUE
, points will be jittered (to avoid overplotting).
emph.dots
logical, if TRUE
, overlapping points at same coordinates
will be becomme larger, so point size indicates amount of overlapping.
auto.jitter
logical, if TRUE
, points will be jittered according
to an overlap-estimation. A matrix of x
and y
values
is created and the amount of cells (indicating a unique point position)
is calculated. If more than 15% (see jitter.ratio
) of the
approximated amount of unique point coordinates seem to
overlap, they are automatically jittered.
jitter.ratio
ratio of tolerated overlapping (see auto.jitter
).
If approximated amount of overlapping points exceed this ratio,
they are automatically jittered. Default is 0.15. Valid values range
between 0 and 1.
show.rug
logical, if TRUE
, a marginal rug plot is displayed
in the graph.
show.legend
logical, if TRUE
, and depending on plot type and
function, a legend is added to the plot.
facet.grid
TRUE
to arrange the lay out of of multiple plots
in a grid of an integrated single plot. This argument calls
facet_wrap
or facet_grid
to arrange plots. Use plot_grid
to plot multiple plot-objects
as an arranged grid with grid.arrange
.prnt.plot
logical, if TRUE
(default), plots the results as graph. Use FALSE
if you don't
want to plot any graphs. In either case, the ggplot-object will be returned as value.