plot.FemFit: Plot an FemFit object.

Description Usage Arguments Details Value Examples

View source: R/plot.FemFit.r

Description

A plot method for "FemFit" objects.

Usage

1
2
3
4
## S3 method for class 'FemFit'
plot(x, formula = prssr_sensor ~ sensor + sessionID,
  colorCode = NULL, subset = NULL, timeScale = 1, xlab = "Time (ms)",
  ylab = NULL, main = NULL, printPlot = TRUE, ...)

Arguments

x

An "FemFit" object.

formula

Specifies the response variable and up to two facetting variables. Must not be a variable used in the colorCode argument.

colorCode

A variable color the pressure traces of the response. Must not be a variable used in the formula argument.

subset

A conditional expression to subset x$df.

timeScale

A numeric constant used to divide x$df$time.

xlab

Label the x-axis.

ylab

Label the y-axis. Defaults to the name of the response variable specified in formula.

main

Label the title.

printPlot

A logical constant to set whether plot.FemFit prints the plot. Defaults to TRUE.

...

Other arguments not used by this method.

Details

The formula has up to three components, y ~ facet_1 + facet_2. y is a variable found in x$df and has special exceptions to grab all sensors when y = prssr_sensor, y = zeroPrssr, or y = tmprtr_sensor.

If you do not want to facet, use . in the RHS of the formula.

There is a special keyword, sensor, which allows the user to facet the pressure traces by sensor number or color the pressure traces by sensor number.

xlab defaults to "Time (s)" if timeScale = 1000 and xlab = "Time (ms)".

timeScale, xlab, ylab, main, and printPlot only uses the first element if there is a vector input.

Value

plot.FemFit silently returns a ggplot2 object which can then be edited.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Load in the FemFit dataset
session488 = read.FemFit("./Datasets_AukRepeat/2c2cc798481d05da_488_csv.zip")

# Plot the FemFit dataset with the default arguments
plot(session488)

# The absence of the `sensor` keyword in the formula argument simultaneously plots all pressure traces with an opacity value fo 25%
plot(session488, formula = prssr_sensor ~ sessionID)

# Utilising the `sensor` keyword in the colorCode argument plots all pressure traces with a unique color.
plot(session488, formula = prssr_sensor ~ sessionID, colorCode = sensor)

# Use subset to plot a portion of the FemFit dataset
plot(session488, subset = JSONLabel == "pfmc3x5s_rest30s")

# xlab, ylab, and title must be character inputs. So, here is the current work-around to use mathematical symbols for those fields
plotObj = plot(session488, formula = zeroPrssr ~ sensor + sessionID, printPlot = FALSE)
plotObj = plotObj + labs(y = expression("Zeroed Pressure ("*Delta*"mmHg)"))
print(plotObj)

TheGreatGospel/IVPSA documentation built on May 19, 2019, 1:47 a.m.