tds.plot: Plot TDS curves

View source: R/tds.R

tds.plotR Documentation

Plot TDS curves

Description

Plots TDS curves based on dominance rates, showing chance and significance lines.

Usage

tds.plot(X, attributes = NULL, times = NULL, chance = NULL, signif = NULL,
 line.col = 1, lty = 1, lwd = 1, las = 0, xlab = "Time (seconds)",
 ylab = "Dominance rate", main = "", height = 8, width = 12, box = FALSE, save.as = "")

Arguments

X

matrix of dominance rates (Attributes in rows, Times in columns).

attributes

a vector of attribute labels, corresponding to the attributes in X.

times

a vector of times, corresponding to the times in X.

chance

proportion indicating the chance level, usually 1/length(attributes) or 1/(1+length(attributes)).

signif

significance level associated with the number of observations and chance.

line.col

A vector of colors for lines corresponding to attributes; see par

lty, lwd

line type and weight for attributes; see par

las

numeric in 0,1,2,3; the style of the axis labels. See: par

xlab, ylab

Labels for the x and y axes; see plot

main

plot title; see plot

height

Window height.

width

Window width.

box

draw box around plot area; see: box

save.as

Filename if the file will be saved.

References

Pineau, N., Schlich, P., Cordelle, S., Mathonnière, C., Issanchou, S., Imbert, A., Rogeaux, M., Etiévant, P., & Köster, E. (2009). Temporal dominance of sensations: Construction of the TDS curves and comparison with time–intensity. Food Quality and Preference, 20, 450–455. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.foodqual.2009.04.005")}

Examples

# example using 'bars' data set
bars.m <- aggregate(bars[, -c(1:4)], list(sample = bars$sample, attribute = bars$attribute), mean)
bars.m <- bars.m[order(bars.m$sample, bars.m$attribute), ]
attributes <- as.character(bars.m$attribute[bars.m$sample == 1])
times <- get.times(colnames(bars.m)[-c(1:2)])
chance <- get.chance(attributes)
signif <- get.significance(chance, nrow(unique(bars[, 1:2])))
tds.plot(get.smooth(bars.m[bars.m$sample == 1, -c(1:2)]), attributes = attributes,
         times = times, chance = chance, signif = signif,
         lwd = 2, main = "Bar 1")

# it is possible to hide the portion of the plot below the significance line:
rect(-2, -0.2, times[length(times)]+2, signif, col = "white", border = "transparent")
# re-add axes & significance line
axis(1, labels = seq(0, 45, by = 5), at = seq(0, 45, by = 5))
axis(2)
abline(h=signif, lty=3, col = "grey")

tempR documentation built on Sept. 8, 2023, 5:19 p.m.

Related to tds.plot in tempR...