generateEffectPlot: Function to define a plot, either showing the main or...

View source: R/plotting.R

generateEffectPlotR Documentation

Function to define a plot, either showing the main or interaction effect in bold.

Description

Function to define a plot, either showing the main or interaction effect in bold.

Usage

generateEffectPlot(
  data,
  x,
  y,
  fillColourGroup,
  ytext = "testylab",
  xtext = "testxlab",
  legendPos = c(0.1, 0.23),
  legendHeading = NULL,
  shownEffect = "main",
  effectLegend = FALSE,
  effectDescription = NULL,
  xLabelsOverwrite = NULL,
  useLatexMarkup = FALSE,
  numberColors = 6
)

Arguments

data

the data frame

x

factor shown on the x-axis

y

dependent variable

fillColourGroup

group to color

ytext

label for y-axis

xtext

label for x-axis

legendPos

position for legend

legendHeading

custom heading for legend

shownEffect

either "main" or "interaction"

effectLegend

TRUE: show legend for effect (Default: FALSE)

effectDescription

custom label for effect

xLabelsOverwrite

custom labels for x-axis

useLatexMarkup

use latex font and markup

numberColors

number of colors

Value

a plot

Examples


set.seed(123)
main_df <- data.frame(
  strategy    = factor(rep(c("A", "B"), each = 20)),
  Emotion     = factor(rep(c("Happy", "Sad"), times = 20)),
  trust_mean  = rnorm(40, mean = 5, sd = 1)
)

generateEffectPlot(
  data = main_df,
  x = "strategy",
  y = "trust_mean",
  fillColourGroup = "Emotion",
  ytext = "Trust",
  xtext = "Strategy",
  legendPos = c(0.1, 0.23)
)


colleyRstats documentation built on May 3, 2026, 5:07 p.m.