Learn R Programming

rENA (version 0.1.1)

ena.plot.trajectory: Plot of ENA trajectories

Description

Function used to plot trajectories

Usage

ena.plot.trajectory(enaplot, points, by = NULL, labels = NULL,
  labels.show = c("Always", "Hover", "Both"), names = NULL,
  label.offset = NULL, label.font.size = enaplot$get("font.size"),
  label.font.color = enaplot$get("font.color"),
  label.font.family = c("Arial", "Courier New", "Times New Roman"),
  shape = c("circle", "square", "triangle-up", "diamond"),
  colors = rep(I("black"), length(unique(by))), confidence.interval = NULL,
  confidence.interval.values = NULL, outlier.interval = NULL,
  outlier.interval.values = NULL, default.hidden = F)

Arguments

enaplot

ENAplot object to use for plotting

points

dataframe of matrix - first two column are X and Y coordinates, each row is a point in a trajectory

by

vector used to subset points into individual trajectories, length nrow(points)

labels

character vector - point labels, length nrow(points)

labels.show

A character choice: Always, Hover, Both. Default: Both

names

character vector - labels for each trajectory of points, length length(unique(by))

label.offset

A numeric vector of an x and y value to offset labels from the coordinates of the points

label.font.size

An integer which determines the font size for labels, default: enaplot\$font.size

label.font.color

A character which determines the color of label font, default: enaplot\$font.color

label.font.family

A character which determines font type, choices: Arial, Courier New, Times New Roman, default: enaplot\$font.family

shape

A character which determines the shape of markers, choices: square, triangle, diamond, circle, default: circle

colors

A character, determines marker color, default: enaplot\$color

confidence.interval

A character that determines which confidence interval type to use, choices: none, box, crosshair, default: none

confidence.interval.values

A matrix/dataframe where columns are CI x and y values for each point

outlier.interval

A character that determines which outlier interval type to use, choices: none, box, crosshair, default: none

outlier.interval.values

A matrix/dataframe where columns are OI x and y values for each point

default.hidden

A logical indicating if the trajectories should start hidden (click on the legend to show them) Default: FALSE

Value

The ENAplot provided to the function, with its plot updated to include the trajectories

See Also

ena.plot

Examples

Run this code
# NOT RUN {
data(RS.data)

codeNames = c('Data','Technical.Constraints','Performance.Parameters',
  'Client.and.Consultant.Requests','Design.Reasoning','Collaboration');

accum = ena.accumulate.data(
  units = RS.data[,c("UserName","Condition")],
  conversation = RS.data[,c("GroupName","ActivityNumber")],
  metadata = RS.data[,c("CONFIDENCE.Change","CONFIDENCE.Pre","CONFIDENCE.Post","C.Change")],
  codes = RS.data[,codeNames],
  window.size.back = 4,
  model = "A"
);

set = ena.make.set(accum);

unitNames = set$enadata$units

### Subset rotated points and plot Condition 1 Group Mean
first.game = unitNames$Condition == "FirstGame"
first.game.points = set$points.rotated[first.game,]

### Subset rotated points and plot Condition 2 Group Mean
second.game = unitNames$Condition == "SecondGame"
second.game.points = set$points.rotated[second.game,]

### get mean network plots
first.game.lineweights = set$line.weights[first.game,]
first.game.mean = colMeans(first.game.lineweights)

second.game.lineweights = set$line.weights[second.game,]
second.game.mean = colMeans(second.game.lineweights)

subtracted.network = first.game.mean - second.game.mean

# Plot dimension 1 against ActivityNumber metadata
dim.by.activity = cbind(
    set$points.rotated[,1],
    set$enadata$trajectories$step$ActivityNumber*.8/14-.4  #scale down to dimension 1
)

plot = ena.plot(set)
plot = ena.plot.network(plot, network = subtracted.network, legend.name="Network")
plot = ena.plot.trajectory(
  plot,
  points = dim.by.activity,
  names = unique(set$enadata$units$UserName),
  by = set$enadata$units$UserName
);
print(plot)

# }

Run the code above in your browser using DataLab