ps_3dPlot
ps_3dPlot.Rd
Create 3-dimensional data plot. The function stops after producing each plot. Enter c ("continue") at the prompt to get the next plot. If this function is run using Rstudio, each plot appears in a separate window, not in the Rstudio plot pane.
Usage
ps_3dPlot(
doc = "ps_3dPlot",
data,
GroupVar,
Groups,
AnalyticVars,
Selections,
ByGroup = FALSE,
PlotMedians = FALSE,
Colors = c("red", "black", "blue", "green", "purple"),
SymbolSize = 0.7
)
Arguments
- doc
A string documenting use written to the output list; default is the function name
- data
A matrix or data frame containing the data to be analyzed
- GroupVar
The name for variable defining grouping
- Groups
A vector of values of group variable for which plots are to be done; if "All", use all groups
- AnalyticVars
A vector of names (character values) of the analytic variables
- Selections
A vector of length 3, or matrix or data frame with 3 columns, with the combinations of the analytic variables to be plotted
- ByGroup
Logical. If TRUE, show scatterplot for each group for each selection of 3 variables; if FALSE (the default), all specified groups are on one plot
- PlotMedians
Logical. If TRUE, plot only the medians in each group (the points are not plotted). If FALSE (the default), the median locations are not plotted
- Colors
A vector with the colors of plotted points, used sequentially for the groups
- SymbolSize
A value at most 1, a smaller value gives smaller diameter points
Value
A list with the following components:
usage: A string with the contents of the argument doc, the date run, the version of R used
dataUsed: The contents of the argument data restricted to the groups used
dataNA: A data frame with observations containing at least one missing value for an analysis variable, NA if no missing values
params: A list with the values of the grouping, logical, numeric and Color arguments
analyticVars: A vector with the value of the argument AnalyticVars
Details
See the vignette for more information: visualizing each plot, specification of the argument Selections as a matrix or data frame, and use of colors. If the plot or plots are not by group, all points have the color of the first element in Colors. If PlotMedians = TRUE, the value of ByGroup is not used.
Examples
# show points from several groups on one plot
data(ObsidianSources)
analyticVars<-c("Rb","Sr","Y","Zr","Nb")
plot3d<-ps_3dPlot(data=ObsidianSources, GroupVar="Code",
Groups=c("A","B"), AnalyticVars=analyticVars,
Selections=rbind(analyticVars[1:3],analyticVars[2:4]))
# plots with one group per plot
data(ObsidianSources)
analyticVars<-c("Rb","Sr","Y","Zr","Nb")
plot3d<-ps_3dPlot(data=ObsidianSources, GroupVar="Code", Groups=c("A","B"),
ByGroup=TRUE, AnalyticVars=analyticVars, Selections=analyticVars[1:3])