Function used to plot trajectories

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 = 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 vector, that determines marker color, default NULL results in alternating random colors. If single color is supplied, it will be used for all trajectories, otherwise the length of the supplied color vector should be equal to the length of the supplied names (i.e a color for each trajectory being plotted) 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 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); ### get mean network plots first.game.lineweights = as.matrix(set$line.weights$Condition$FirstGame)
first.game.mean = colMeans(first.game.lineweights)

second.game.lineweights = as.matrix(set$line.weights$Condition$SecondGame) 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( as.matrix(set$points)[,1],
set$trajectories$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$model$unit.label),
by = set$trajectories$ENA_UNIT
);
print(plot)