plot-methods: Additional Methods for Function 'plot' in Package 'graphics'

plot-methodsR Documentation

Additional Methods for Function plot in Package graphics

Description

These additional methods extend function plot in package graphics, enabling DVH visualization in package RadOnc

Usage

## S3 method for class 'DVH'
plot(x, ..., plot.type = NULL)

## S3 method for class 'DVH.list'
plot(x, ..., plot.type = NULL)

Arguments

x

Can represent either an object of class DVH, zDVH, or DVH.list

...

May contain any number of objects of class DVH or DVH.list. Note that at least one object of either class is required if plot.type = "ttest" or "wilcox". Specification of more than one zDVH will reduce all input zDVH objects to DVH objects for standard plotting.

plot.type

A character string specifying the type of plot to generate, must be one of "individual" (default), "grouped", "ttest", "wilcox", "bars", or "correlation". Parameter plot.type will be ignored if x is a zDVH object.

Details

See package vignette and examples (below) for more details about each plotting subtype.

Graphical Parameters

alpha

When plot.type="ttest", "wilcox", or "correlation", this specifies the numerical value (threshold) used to display significant p-values.

angle

The slope of shading lines, given as an angle in counter-clockwise degrees (default is 45). This parameter is ignored if density=NULL or NA or wherever fill=FALSE or is ignored (e.g. when plot.type="individual" or "bars"). Also note that this paramater can represent a list of different angles, with length of the list corresponding to the number of DVH or DVH.list objects.

back

A character value specifying the back-facing surface fill method when x is a zDVH object (the parameter is otherwise ignored). Value must be one of "filled", "lines", "points", or "culled". Default value is assigned from input parameter front.

center

A character value specifying where to plot the center of a group when plot.type="grouped" (the parameter is otherwise ignored). Value must be one of "mean" or "median". Note: As of package v.1.0.3, this parameter is considered defunct and will be disregarded accordingly.

col

The color to be used for drawing lines. This parameter can also represent a list of different colors, with length corresponding to the number of DVH, zDVH, or DVH.list objects (if plot.type="individual", number of colors should correspond to number of individual DVH objects).

When plot.type="bars", col instead represents a list of colors used to define the shading scheme applied to the entire dose range. Default color scheme is a standard rainbow, with colors ranging from "blue" to "red". Actual default is specified as rev(rainbow(n=10, start=0, end=2/3)). See colors for more options and information.

density

The density of shading lines, in lines per inch. The default value of NULL means that no shading lines are drawn. A zero value of density means no shading nor filling, whereas negative values and NA suppress shading lines but allow solid color filling. Note that this paramater can also represent a list of different densities, with length of the list corresponding to the number of DVH or DVH.list objects.

fill

Logical, defaulting to TRUE. Determines whether or not to draw shading around groups of DVH lines. Note that this parameter is relevant when plot.type="grouped", "ttest" or "wilcox" (it is ignored when plot.type="individual" or "bars").

fill.lty

The line type used for shading (per density and angle parameters). See lty above for further specifications of line types. Note that this paramater can represent a list of different line types, with length corresponding to the number of DVH or DVH.list objects.

fill.transparency

Factor modifying the transparency of filling/shading (value must be between [0,1]), with fill.transparency=0 specifying complete transparency and 1 specifying complete opacity. Note that this parameter can represent a list of different transparency factors, with length corresponding to the number of DVH or DVH.list objects. Default value is line.transparency/2.

front

A character value specifying the front-facing surface fill method when x is a zDVH object (the parameter is otherwise ignored). Value must be one of "filled" (default), "lines", "points", or "culled".

grid

Logical, defaulting to FALSE. Determines whether or not to draw gridlines on 2D plot. Note that this parameter is relevant when plot.type="individual", "grouped", "ttest", or "wilcox" (it is ignored when plot.type="bars" or when plotting zDVH objects).

highlight

The color to be used for shading p-value data when plot.type="ttest" or "wilcox". See colors for more options and information.

legend

Value specifying the location to draw a figure legend, must be one of "topright", "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "right", or "center". These keywords place the legend on the inside of the plot frame at the location specified. Partial argument matching is used. If legend=NA (default), the legend is not drawn.

When plot.type="bars", legend is interpreted instead as a logical value and must be either TRUE (default) or FALSE. If TRUE, labels are drawn at the bottom of the plot, outside of the actual plotting frame.

Note that legend parameter is ignored when plot.type="wilcox" and panel.lower="difference".

legend.labels

A character or expression vector specifying the text to appear in the legend, when relevant. Length of legend.labels must match the numer of DVH and DVH.list objects, otherwise legend text will default to the form: "Group 1", "Group 2", ...

line.transparency

Factor modifying the transparency of line drawings (value must be between [0,1]), with fill.transparency=0 specifying complete transparency and 1 (default) specifying complete opacity. Note that this parameter can represent a list of different transparency factors, with length corresponding to the number of DVH or DVH.list objects (if plot.type="individual", number of transparency factors should correspond to number of individual DVH objects).

lty

The line type. Line types can either be specified as an integer (0=blank, 1=solid (default), 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash) or as one of the character strings "blank", "solid", "dashed", "dotted", "dotdash", "longdash", or "twodash", where "blank" uses 'invisible lines' (i.e., does not draw them).

Alternatively, a string of up to 8 characters (from c(1:9, "A":"F")) may be given, giving the length of line segments which are alternatively drawn and skipped (see par for more details). Note that this paramater can also represent a list of different line types, with length corresponding to the number of DVH or DVH.list objects (if plot.type="individual", number of line types should correspond to number of individual DVH objects).

lwd

The line width, a emphpositive number, defaulting to 1. The interpretation is device-specific, and some devices do not implement line widths less than one (see the help on the device for details of the interpretation). Note that this paramater can also represent a list of different line widths, with length of the list corresponding to the number of DVH or DVH.list objects (if plot.type="individual", number of line widths should correspond to number of individual DVH objects).

main

An overall title for the plot (see title, default is "").

multiplier

A single numerical value (default is 1) specifying the degree to which group display width should be shrunken or magnified. This parameter is only processed when plot.type="grouped" or "ttest" and width="mad", "sd", or "var".

new

Logical, defaulting to TRUE. If set to FALSE, the next high-level plotting command (actually plot.new) should not clean the frame before drawing as if it were on a new device. It is an error (ignored with a warning) to try to use new=FALSE on a device that does not currently contain a high-level plot.

panel.lower

Value specifying the lower panel plot content when plot.type="wilcox" (panel.lower must be one of "grouped" or "wilcox" [default]). Partial argument matching is used. When panel.lower="wilcox", the median groupwise differences will be displayed with associated confidence intervals obtained from wilcox.test(). When panel.lower="grouped", the individual groups are displayed with surrounding user-specified intervals (see width, quantile, and multiplier parameters).

quantile

A numeric vector containing two values in [0,1] (default is the interquartile range: (0.25, 0.75)), specifying the lower and upper probabilities (respectively) to be used when width="quantile" and plot.type="grouped" or "ttest". See quantile for more details.

width

A character vector specifying the width of shading to use, when relevant (for a group of DVHs). Value must be one of "range" (default), "mad", "IQR", "quantile", "var", or "sd", specifying the absolute range, the mean-absolute-deviation, the interquartile (25-75%) range, the arbitrary inter-quantile range (see quantile parameter), the group variance, or standard deviation, respectively. This parameter is ignored unless plot.type="grouped". If plot.type="ttest", the parameter can be optionally specified (if width=NULL (default), shading will default to the confidence interval).

xlim

A numeric vector of length 2 specifying the minimum and maximum x coordinates for plotting (note that this parameter is ignored when plot.type="bars", new=FALSE, or plotting object(s) of class zDVH).

ylim

A numeric vector of length 2 specifying the minimum and maximum y coordinates for plotting (note that this parameter is ignored when plot.type="bars", new=FALSE, or plotting object(s) of class zDVH).

Additional Parameters

alternative

When plot.type="ttest", "wilcox", or "correlation", alternative indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter. "greater" corresponds to positive association, "less" to negative association. See cor.test for more details.

dose

Value specifying dose scale (must be one of "relative" or "absolute").

dose.units

Value specifying dose units (must be one of "cGy" or "Gy").

exact

When plot.type="wilcox" or plot.type="correlation" and method="kendall" or "spearman", exact specifies a logical indicating whether an exact p-value should be computed. See cor.test or wilcox.test for more details.

method

When plot.type="correlation", method specifies a character string indicating which correlation coefficient is to be computed. Value must be one of "pearson" (default), "kendall", or "spearman". See cor.test for more details.

mu

When plot.type="ttest" or "wilcox", specifies an optional parameter used to form the null hypothesis. See t.test or wilcox.test for more details.

paired

A logical value (default is FALSE) specifying whether or not to perform paired groupwise comparisons when plot.type="ttest" or "wilcox".

type

Value specifying type of dose-volume histogram to plot (must be one of "cumulative" or "differential").

volume

Value specifying volume scale (must be one of "relative" or "absolute").

See Also

plot

Examples

	# plot(x, ..., plot.type="individual")
	OARs <- c("LIVER","STOMACH","DUODENUM")
	cols <- c("red", "darkgreen", "blue")
	plot(johndoe[OARs], col=cols, lty=1:3, legend="topright", legend.labels=OARs, main="OARs")
	
	# plot(x, ..., plot.type="bars")
	plot(janedoe[2:9], plot.type="bars", volume="absolute",dose="relative")
	
	# plot(x, ..., plot.type="grouped")
	plot(c(johndoe["STOMACH"],janedoe["STOMACH"]), #group 1
		c(johndoe[c("CTV","PTV")],janedoe[c("CTV","PTV")]), #group 2
		c(janedoe["LIVER"],johndoe["LIVER"]), #group 3
		c(johndoe["DUODENUM"],janedoe["DUODENUM"]), #group 4
		plot.type="grouped", col=c("orange","green","blue","red"), lwd=2, dose="relative")
		
	# plot(x, ..., plot.type="ttest")
	# OARs <- c("LIVER", "STOMACH", "SMALL_BOWEL")
	# plot(c(johndoe[c("CTV","PTV")],janedoe[c("CTV","PTV")]), #group 1
	#	c(janedoe[OARs],johndoe[OARs]), #group 2
 	#	plot.type="t", col=c("red", "blue"), lty=2, fill.lty=1, main="Target v. OAR t-Test")
 		
	# plot(x, ..., plot.type="wilcox")
	# plot(c(johndoe[c("CTV","PTV")],janedoe[c("CTV","PTV")]), #group 1
	#	c(janedoe[OARs],johndoe[OARs]), #group 2
 	#	plot.type="w", col=c("red", "blue"), lty=2, fill.lty=1, main="Target v. OAR",
 	#	panel.lower="grouped")
 	
 	# plot(x, ..., plot.type="correlation")
	# plot(janedoe, sample(1:100, 10), plot.type="correlation", method="kendall")
	

reidt03/RadOnc documentation built on Sept. 29, 2022, 9:50 a.m.