Learn R Programming

rysgran (version 1.0)

rysgran.plot: Generates a Bivariate Plot

Description

rysgran.plot generates a bivariate plot of grain size statistical parameters passed by gran.stats function or another grain size data matrix

Usage

rysgran.plot(x = NULL, y = NULL, data = NULL, lang = "en-US",
    main = NULL, xlab = NULL, ylab = NULL, show.labels = FALSE,
    label.points = FALSE, pch = 1, col.labels = "black",
    labels = NULL, col = "black", cex.labels = 1, cex.points=1,
    pos = 1, z.cex.range = NULL, z = NULL, ...)

Arguments

x
the x coordinates of points in the bivariate plot. The value should be presented in quotation marks. Abbreviations are accepted in upper and lower case as well as the full name of the variable, independent of the chosen language. Examples of accepted valu
y
the y coordinates of points in the bivariate plot. has the same prerequisites for the argument x
data
a data matrix created by gran.stats function or another grain size stattistical parameters data matrix
lang
language . Should be english ("en-US", "en-GR", "eng", "e"), or portuguese ("pt-BR", "pt-PT", "port", "p"). The default is "en-US"
main
an overall title for the plot. If NULL it will be generated an automatic title according to language chosen. defaut is NULL
xlab
a title for the x axis. If NULL it will be generated an automatic title according to language chosen. defaut is NULL
ylab
a title for the y axis. If NULL it will be generated an automatic title according to language chosen. defaut is NULL
show.labels
logical. If TRUE the points are replaced by text passed by labels argument. Default is FALSE
label.points
logical. if TRUE text is added, provided by the argument labels, with the points on the graph. the text position to the point should be changed by argument pos. labels.points will be automatically FALSE if show
pch
Either an integer specifying a symbol or a single character to be used as the default in plotting points. Default is "1"
col.labels
color of text if the arguments show.label, label.points or z are defined. Default is "black"
labels
a character vector or expression specifying the text to be written. If NULL labels will be the row names of the data argument. Default is NULL
col
symbol color used in pch argument. Default is "black"
cex.labels
character size of text provided by the argument labels added with the point (or replacing it) in case show.label, label.points or z arguments are defined. Default is "1"
cex.points
character size of points provided by the argument pch. Default is "1"
pos
a position specifier for the text. Values of 1, 2, 3 and 4, respectively indicate positions below, to the left of, above and to the right of the specified coordinates. Default is "1"
z.cex.range
Vector of 2 numericals. Minimum and maximum 'cex' of the bubbles plotted if 'z' is not NULL. Replace the argument cex.points. Default is "(1,3)"
z
vector with the same length of x and y whoose value must be used to define the points expansion factor and color (bubble plot). If NULL, a simple plot is drawn (no 'bubbles'). Default is "NULL"
...
further graphical parameters

Value

  • return a bivariate plot

Details

If the data matrix provided to data argument has not been generated by the gran.stats function its column names must be complete and written with an initial uppercase letter, regardless of the column orders. For example, if the user write "kurt" (in quotation marks) in the x or y arguments rysgran.plot seek into data a column called "Kurtosis". Same rules apply for the portuguese language

See Also

gran.stats, class.percent, rysgran.ternary, rysgran.hist

Examples

Run this code
# Plot Mean and Sorting
library(rysgran)
data(camargo2001)
tab<-camargo2001
rys <- gran.stats(tab , method="folk" , verbal=FALSE , lang="en-US")
rysgran.plot ("mean" , "sort" , data=rys)
#
# Using show.labels
library(rysgran)
data(camargo2001)
tab<-camargo2001
rys <- gran.stats(tab , method="folk" , verbal=FALSE , lang="en-US")
rysgran.plot("mean" , "sort" , data=rys , lang="en-US",
	show.labels = TRUE, col.labels = "blue",
	labels = NULL, cex.labels = 0.8)
#
# Skewness and Kurtosis with label.points
library(rysgran)
data(camargo2001)
tab<-camargo2001
rys <- gran.stats(tab , method="folk" , verbal=FALSE , lang="en-US")
rysgran.plot ("skew" , "kurt" , data=rys , lang="en-US",
	show.labels = FALSE, labels = NULL, label.points = TRUE, 
	pch = 19, col.labels = "black", col = "blue", cex.labels = 0.8, 
	cex.points = 1, pos=1)
#
# Sorting and Kurtosis with Mean as bubbles
library(rysgran)
data(camargo2001)
tab<-camargo2001
rys <- gran.stats(tab , method="folk" , verbal=FALSE , lang="en-US")
rysgran.plot ("sort" , "kurt" , data=rys , lang="en-US",
	show.labels = FALSE, labels = NULL, label.points = TRUE,
	pch = 21, col.labels = "white", col = "red", cex.labels = 0.8, 
	pos=NULL, z=rys$Mean, z.cex.range=c(2.5,6), bg="red")
#
# With legend
library(rysgran)
data(camargo2001)
tab<-camargo2001
rys <- gran.stats(tab , method="folk" , verbal=FALSE , lang="en-US")
months <- as.factor(rep(c("Jan","Mar","May","Jul","Sep"),each=7))
months <- factor(months, levels = c("Jan","Mar","May","Jul","Sep"))
rysgran.plot ("sort" , "kurt",  data = rys, lang="en-US",
	show.labels = FALSE, label.points = TRUE, 
	pch =  c(15,17,18,19,20)[months], 
	col.labels = "black", labels = months, cex.labels = 0.8,
	col = c("black","brown","blue","red","green")[months],
	cex.points = 2, pos=1, z.cex.range=NULL, z=NULL)
legend("topright", c("January","March","May","July","September") , 
	pch= c(15,17,18,19,20), col= c("black","brown","blue","red","green"))

Run the code above in your browser using DataLab