plotProfiles: Produces profile plots of longitudinal data for a set of...

plotProfilesR Documentation

Produces profile plots of longitudinal data for a set of individuals


Produce profile plots of longitudinal data for a response using ggplot. A line is drawn for the data for each individual and the plot can be faceted so that a grid of plots is produced. For each facet a line for the medians over time can be added, along with the vaue of the outer whiskers (median +/- 1.5 * IQR).


plotProfiles(data, response = "PSA", 
             individuals = "Snapshot.ID.Tag", times = "DAP", 
             x = NULL, title = NULL, 
             x.title = "DAP", y.title = "PSA (kpixels)", 
             facet.x = ".", facet.y = ".", 
             labeller = NULL, scales = "fixed", 
             breaks.spacing.x = -2, angle.x = 0, 
             colour = "black", 
             colour.column = NULL, colour.values = NULL, 
             alpha = 0.1, addMediansWhiskers = FALSE, 
             ggplotFuncs = NULL, 
             printPlot = TRUE)



A data.frame containing the data to be plotted.


A character specifying the response variable that is to be plotted on the y-axis.


A character giving the name of the factor that defines the subsets of the data for which each subset corresponds to the response values for an individual (e.g. plant, pot, cart, plot or unit).


A character giving the name of the column in data containing the times at which the data was collected, either as a numeric, factor, or character. If not a numeric, it will be converted to a numeric and used to provide the values to be plotted on the x-axis. If a factor or character, the values should be numerics stored as characters.


A character specifying a variable, or a function of variables, to be plotted on the x-axis. If NULL, it will be set to the value of times, which it can be assumed will be converted to a numeric.


Title for the x-axis.


Title for the y-axis.


Title for the plot.


A data.frame giving the variable to be used to form subsets to be plotted in separate columns of plots. Use "." if a split into columns is not wanted.


A data.frame giving the variable to be used to form subsets to be plotted in separate rows of plots. Use "." if a split into rows is not wanted.


A ggplot function for labelling the facets of a plot produced using the ggplot function. For more information see ggplot.


A character specifying whether the scales are shared across all facets of a plot (the default, "fixed"), or do they vary across rows ("free_x"), columns ("free_y"), or both rows and columns ("free")?


A numeric whose absolute values specifies the distance between major breaks for the x-axis in a sequence beginning with the minimum x value and continuing up to the maximum x value. If it is negative, the breaks that do not have x values in data will be omitted. Minor breaks will be at half major break value or, if these do not correspond to x-values in data when breaks.spacing.x is negative, have a spacing of one. Thus, when breaks.spacing.x is negative, grid lines will only be included for x-values that occur in data. These settings can be overwritten by supplying, in ggplotFuncs, a scale_x_continuous function from ggplot2.


A numeric between 0 and 360 that gives the angle of the x-axis text to the x-axis. It can also be set by supplying, in ggplotFuncs, a theme function from ggplot2.


A character specifying a single colour to use in drawing the lines for the profiles. If colouring according to the values of a variable is required then use colour.column.


A character giving the name of a column in data over whose values the colours of the lines are to be varied. The colours can be specified using colour.values.


A character vector specifying the values of the colours to use in drawing the lines for the profiles. If this is a named vector, then the values will be matched based on the names. If unnamed, values will be matched in order (usually alphabetical) with the limits of the scale.


A numeric specifying the degrees of transparency to be used in plotting. It is a ratio in which the denominator specifies the number of points (or lines) that must be overplotted to give a solid cover.


A logical indicating whether plots over time of the medians and outer whiskers are to be added to the plot. The outer whiskers are related to the whiskers on a box-and-whisker and are defined as the median plus (and minus) 1.5 times the interquartile range (IQR). Points lying outside the whiskers are considered to be potential outliers.


A list, each element of which contains the results of evaluating a ggplot function. It is created by calling the list function with a ggplot function call for each element. These functions are applied in creating the ggplot object.


A logical indicating whether or not to print the plot.


An object of class "ggplot", which can be plotted using print.


Chris Brien

See Also

ggplot, labeller.


plotProfiles(data = longi.dat, response = "sPSA", times = "DAP")

plt <- plotProfiles(data = longi.dat, response = "sPSA", 
                    y.title = "sPSA (kpixels)", 
                    facet.x = "Treatment.1", facet.y = "Smarthouse", 
                    breaks.spacing.x = 2,
plt <- plt + ggplot2::geom_vline(xintercept=29, linetype="longdash", linewidth=1) +

plotProfiles(data = longi.dat, response = "sPSA", times = "DAP", 
             x.title = "DAP", y.title = "sPSA (kpixels)", 
             facet.x = "Treatment.1", facet.y = "Smarthouse", 
                 ggplotFuncs = list(ggplot2::geom_vline(xintercept=29, 
                                    ggplot2::scale_x_continuous(breaks=seq(28, 42, 

growthPheno documentation built on May 29, 2024, 6:03 a.m.