ez.scatterplot2: scatter plot with ggplot

View source: R/plot.R

ez.scatterplot2R Documentation

scatter plot with ggplot

Description

scatter plot with ggplot

Usage

ez.scatterplot2(
  df,
  cmd,
  rp.size = 5,
  rp.x = 0.25,
  rp.y = 0.99,
  colors = ez.palette("Zhu"),
  shapes = c(16, 17, 15, 3, 7, 8),
  line.color = "#BE1B22",
  point.color = "#0086B8",
  point.shape = 16,
  point.alpha = 0.95,
  point.size = 3,
  rug.size = 0.25,
  ylab = NULL,
  xlab = NULL,
  zlab = NULL,
  legend.position = "top",
  legend.direction = "horizontal",
  legend.box = T,
  legend.size = c(0, 10),
  rp = TRUE,
  se = TRUE,
  rug = FALSE,
  ellipse = FALSE,
  theme.apa = TRUE
)

Arguments

df

data frame

cmd

like "y~x+a+b", "y~x+a+b|z", "y~x+a+b||z", "y~x+a+b|||z"where y x are continous, z discrete (| one regression line, || multiple regression lines by levels of z–gives interaction p value), +a+b optional for covariates residualization
y~x+a+b|||z an invisible plotlist returned, call ggmultiplot(plotlist)

rp.size

r p values font size, ignored if rp=FALSE

rp.x

r p values x position (0-1, relative to top left, big–>right), ignored if rp=FALSE. Internally, convert to geom_label(x,y) where x,y refers to actually x,y axis value

rp.y

r p values y position (0-1, relative to top left, big–>bottom), ignored if rp=FALSE

line.color

only applicable when y~x and y~x|z (ie, not auto varied with aes()), regression line color

point.color

only applicable when y~x (ie, not auto varied with aes()). for auto ones, use scale_*_*

point.shape

only applicable when y~x (ie, not auto varied with aes()). for auto ones, use scale_*_*

point.alpha

if overplot for points, reduce alpha

point.size

if less point, increase size

rug.size

rug size

ylab

y label NULL

xlab

x label NULL

zlab

z/fill/legend label, only applicable when there is z provided NULL

legend.position

legend position 'top', 'bottom', 'left', 'right', 'none', c(x,y,two-element numeric vector)
c(0,0) corresponds to the "bottom left" and c(1,1) corresponds to the "top right" position.

legend.direction

horizontal or vertical

legend.box

box of legend, T or F

legend.size

c(0,10) the first number 0 controls the legend title, 0=hide; the second number controls legend.key.size, legend.text

rp

show r (signed) and p values

se

standard error of linear regression line

rug

marginal rug indicating univariate distribution

ellipse

draw confidence ellipses, powered by stat_ellipse()

Value

a ggplot object (+theme_apa() to get apa format plot)


jerryzhujian9/zmisc documentation built on March 9, 2024, 12:49 a.m.