JASPScatterPlot.Rd
Create a scatter plot with density
JASPScatterPlot(
x,
y,
group = NULL,
xName = NULL,
yName = NULL,
addSmooth = TRUE,
addSmoothCI = TRUE,
smoothCIValue = 0.95,
forceLinearSmooth = FALSE,
plotAbove = c("density", "histogram", "none"),
plotRight = c("density", "histogram", "none"),
colorAreaUnderDensity = TRUE,
alphaAreaUnderDensity = 0.5,
showLegend = !is.null(group),
legendTitle = NULL,
emulateGgMarginal = FALSE,
...
)
x variable.
y variable.
optional grouping variable.
name on x-axis.
name on y-axis.
should a smoothed regression line be drawn?
should a confidence interval be added to the smoothed regression line?
a numeric in (0, 1) indicating the confidence interval.
should the regression line be linear?
type of plot above the scatter plot.
type of plot right of the scatter plot.
Logical, should the area under the density be colored?
Real in [0, 1], transparency for area under density.
Should the legend be shown?
A string for the title of the legend. NULL
implies the legend is not shown.
Should the result be as similar as possible to ggMarginal
? Overwrites other parameters.
passed to themeJaspRaw
.
The only change added when emulateGgMarginal = TRUE
is that ggplot2::theme(plot.margin = unit(c(0, 0, 0.25, 0.25), "cm"))
is added to the main plot
if (FALSE) { # \dontrun{
x <- rnorm(100)
y <- rgamma(100, 1, 1)
JASPScatterPlot(x, y, xName = "Normal", yName = expression(gamma))
JASPScatterPlot(x, y, xName = "Normal", yName = expression(gamma), forceLinearSmooth = TRUE)
JASPScatterPlot(x, y, xName = "Normal", yName = expression(gamma), forceLinearSmooth = TRUE,
smoothCIValue = .99)
JASPScatterPlot(x, y, xName = "Normal", yName = "Gamma", addSmooth = FALSE)
JASPScatterPlot(x, y, xName = "Normal", yName = "Gamma", addSmoothCI = FALSE)
JASPScatterPlot(x, y, xName = "Normal", yName = "Gamma", plotAbove = "histogram")
JASPScatterPlot(x, y, xName = "Normal", yName = "Gamma", plotAbove = "histogram",
plotRight = "histogram")
JASPScatterPlot(x, y, xName = "Normal", yName = "Gamma", plotAbove = "histogram",
plotRight = "none")
JASPScatterPlot(x, y, xName = "Normal", yName = "Gamma", plotAbove = "none",
plotRight = "none")
# we can do the same with a grouping variable
data("mtcars")
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl)
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl, plotAbove = "none")
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl, plotRight = "none")
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl, plotRight = "none",
plotAbove = "none")
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl, plotAbove = "histogram",
plotRight = "histogram")
# the color scheme can be changed with the global options:
oldColor <- graphOptions("palette")
graphOptions(palette = "ggplot2")
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl)
graphOptions(palette = "viridis")
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl)
graphOptions(palette = "colorblind3")
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl)
graphOptions(palette = "gray")
JASPScatterPlot(x = mtcars$mpg, y = mtcars$disp, group = mtcars$cyl)
graphOptions(palette = oldColor)
## NOT RUN
# spot the differences (if you find any report them to the package maintainer!)
plot <- JASPScatterPlot(x, y, xName = "Normal", yName = "Gamma", addSmooth = FALSE,
emulateGgMarginal = TRUE)
plot
# ggExtra::ggMarginal(plot$subplots[[1]])
} # }