tds.plot {tempR} | R 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 |
times |
a vector of times, corresponding to the times in |
chance |
proportion indicating the chance level, usually |
signif |
significance level associated with the number of observations and |
line.col |
A vector of colors for lines corresponding to |
lty , lwd |
line type and weight for attributes; see |
las |
numeric in |
xlab , ylab |
Labels for the x and y axes; see |
main |
plot title; see |
height |
Window height |
width |
Window width |
box |
draw box around plot area; see: |
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. 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")