ez.xyplot: mimic xyplot with ggplot (slightly horizontally jittered)

View source: R/plot.R

ez.xyplotR Documentation

mimic xyplot with ggplot (slightly horizontally jittered)

Description

mimic xyplot with ggplot (slightly horizontally jittered)

Usage

ez.xyplot(
  df,
  cmd,
  ylab = NULL,
  xlab = NULL,
  xangle = 0,
  vjust = NULL,
  hjust = NULL,
  facet = "cols",
  theme.apa = TRUE
)

Arguments

df

data frame in long format

cmd

like "y|x,g", "y|x z,g", or "y|x z a,g" where y is continous or discrete (e.g., dx), x z a are discrete, g is individual/grouping variable
'FinalMem|Attention, SubjectID' 'FinalMem|Attention Condition, SubjectID'

ylab

y label NULL

xlab

x label NULL

xangle

angle of x-axis text 0

vjust

vjust of x-axis text NULL. hjust and vjust are only defined between 0 and 1, 0 means left-justified, 1 means right-justified

hjust

hjust of x-axis text NULL

facet

one of 'cols', 'rows', 'wrap'

Value

a ggplot object (+theme_apa() to get apa format plot), +scale_y_continuous(limits=c(-5,8),breaks=seq(-5,8,by=2),oob=scales::rescale_none)
see http://stackoverflow.com/a/31437048/2292993 for discussion


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