figOverplot {GCDkit} | R Documentation |
This function allows overplotting new data points onto Figaro-compatible binary or ternary plots, or patterns onto spiderplots. It is most useful in adding selected data from typical geochemical reservoirs (e.g., Upper Continental Crust, MORB ...), ideal mineral compositions, results of petrogenetic modelling or just another dataset used for comparison (any of these will be henceforth referred to as a reference dataset).
figOverplot(var.name, mat=NULL, sample.names=NULL, condition=NULL, labs=NULL, autoscale=FALSE, pch="*", col="darkred", cex=1, type="p", just.draw = FALSE,overplotDataset = FALSE,...)
var.name |
either ' |
mat |
matrix with data for all reservoirs available for overplotting. Meant mainly for internal use of the GCDkit system. |
sample.names |
character vector; list of names of desired reservoirs, ideal minerals or samples in the reference dataset to be overplotted. |
condition |
text; regular expression specifying names of desired reservoirs, ideal minerals or samples in the reference dataset. |
labs |
text; optional (typically abbreviated) labels for the overplotted data from the reference dataset. |
autoscale |
logical; should be the scaling changed so that all the plotted analyses fit in? |
pch |
plotting symbol(s) for the reference dataset. |
col |
plotting colour(s) for the reference dataset. |
cex |
numeric; relative size of the plotting symbol(s) for the reference dataset. |
type |
character; plot type; see plot.default. For obvious reasons, not implemented for spiderplots. |
just.draw |
logical; if |
overplotDataset |
logical; for internal use by the system only. |
... |
additional parameters to the underlying plotting function(s). See Details. |
If called directly, the function is employed to overplot data from a reference dataset,
either real-world data or a numeric matrix spanning, for instance, from petrogenetic
modelling. The data originate from a two-dimensional variable
in the global environment, whose name is provided via the obligatory argument
'var.name
'.
Argument 'mat
' is meant for internal use by the system and does not need to
be specified by the user as the data frame/matrix mat
is generated automatically
by the function 'figOverplot
'.
In both cases, the selection from the numeric matrix or dataframe 'mat
' is
based on a list of desired 'sample.names
' or on a regular expression yielding
their subset ('condition
'). Of course, from this selection, only analyses
with data sufficient to be plotted on the current diagram are used.
If neither 'sample.names
' nor 'condition
' is provided, all samples are shown.
For plotting are used functions 'points', 'triplotadd' and 'spider'
for binary plots, ternary plots and spiderplots, respectively.
Argument '...
' can supply additional parameters to these low-level plotting
functions.
Optional parameter 'labs
' can specify alternative, typically abbreviated textual
labels to the points plotted.
Logical argument 'autoscale
' determines whether the plot should be rescaled
to accommodate both the original data points and the reference dataset.
Clearly, it does not make sense for a ternary plot.
By default, the overplotted information is added permanently but this behaviour is
controlled by the argument just.draw
.
A numeric matrix with the overplotted analyses from the reference dataset.
Within the GCDkit system, this function is invoked by 'figAddReservoirs'
to overplot selected compositions from typical geochemical reservoirs
(system file 'reservoirs.data
') or chemistries of ideal minerals
(system file 'idealmins.data
').
If just.draw=FALSE
, the points for the reference dataset do not
become a part of the template, and thus will vanish upon redrawing, zooming
.... See Examples.
Vojtěch Janoušek, vojtech.janousek@geology.cz
figAddReservoirs plateAddReservoirs
figOverplotDiagram overplotDataset
data(sazava) accessVar("sazava") setCex(1.5) pokeDataset("sazava", overwrite.warn=FALSE) # Calculate Rayleigh-type fractionation trend ff<-seq(1,0.1,-0.1) # F, amount of melt left x<-80*ff^(1.2-1) # cL for three elements, arbitrary D of 1.2, 2.0 and 1.3 y<-550*ff^(2.0-1) z<-1000*ff^(1.3-1) my.trend<-cbind(x,y,z) colnames(my.trend)<-c("Rb","Sr","Ba") rownames(my.trend)<-ff # By default, the overplotted information is added permanently binary("Rb","Sr",log="xy") figOverplot(var.name="my.trend",pch="+",col="blue",autoscale=TRUE,type="o", labs=rownames(my.trend)) figXlim(c(30,100)) # But this is controlled by the argument just.draw binary("Rb","Sr",log="xy") figOverplot(var.name="my.trend",pch="+",col="darkred",autoscale=TRUE,type="o", labs=rownames(my.trend),just.draw=TRUE) # Any function redrawing the plotting window will wipe the added trend out figXlim(c(30,100)) # Ternary ternary("10*Rb","2*Sr","Ba/2") figOverplot(var.name="my.trend",pch="+",col="blue",type="o", labs=rownames(my.trend))