figAddReservoirs {GCDkit} | R Documentation |
This functions overplots data from some geochemical reservoirs to Figaro-compatible plots.
figAddReservoirs(autoscale=FALSE, var.name=NULL, sample.names=NULL, reserv.condition=NULL, labs=NULL, pch="*", col="darkred", cex=1, type="p",...)
autoscale |
logical; should be the scaling changed so that all the plotted data fit in? |
var.name |
text; either ' |
sample.names |
character vector; names of reservoirs, ideal minerals or samples to be plotted. |
reserv.condition |
text; regular expression specifying reservoirs compositions of which are to be plotted. |
labs |
text; optional abbreviated labels for the individual reservoirs |
pch |
plotting symbol. |
col |
plotting colour. |
cex |
numeric; relative size of the plotting symbol. |
type |
character; plot type; see plot.default. |
... |
further arguments of the respective plotting functions. |
'figAddReservoirs
' overplots compositions of selected geochemical reservoirs
(taken from the file 'reservoirs.data
', see selectNorm
for the file structure as well as relevant references) or ideal minerals
(from the file 'idealmins.data
').
Alternatively, if the name of a numeric matrix or dataframe in the global
environment is provided via the argument 'var.name
', the selection of data
from this object is used (see Examples). The selection is specified by either
'sample.names
' or by 'reserv.condition
' parameters.
Optional argument 'labs
' can specify alternative,
perhaps abbreviated textual labels to the points plotted.
Please note that the function 'figAddReservoirs
' is available
so far for simple spiderplots, binary and ternary plots only. Technically,
the function invokes 'figOverplot' setting
just.draw=FALSE
, and thus the overplotted dataset is added permanently.
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.
A numeric matrix with the overplotted analyses from the reference dataset.
Colin M. Farrow, colinfarrow537@gmail.com
Vojtěch Janoušek, vojtech.janousek@geology.cz
contourGroups chullGroups legend showLegend
figOverplot figOverplotDiagram overplotDataset curve
sampleDataset("blatna") setCex(1.5) ## figAddReservoirs # binary plots binary("Zr/Nb","Ba/La") # Sun & McDonough mantle reservoirs, Taylor & McLennan 1995 Upper and Lower Crust reserv<-c("(MORB|OIB)..Sun","Upper Continental Crust..Taylor","Lower Continental Crust..Taylor") reserv.names<-c("NMORB","EMORB","OIB","UCC","LCC") # Temporary drawing figAddReservoirs(autoscale=TRUE,var.name="reservoirs.data", reserv.condition=reserv,labs=reserv.names,just.draw=TRUE) figRedraw() # Permanent drawing (the default behaviour) figAddReservoirs(autoscale=TRUE,var.name="reservoirs.data", reserv.condition=reserv,labs=reserv.names,just.draw=FALSE) figRedraw() binary("SiO2","K2O") figAddReservoirs(TRUE,var.name="idealmins.data",sample.names=c("Or","Bt","Ph")) # ternary plots plateExtract("Wood",1) reserv<-c("(MORB|OIB)..Sun","Upper Continental Crust..Taylor","Lower Continental Crust..Taylor") reserv.names<-c("NMORB","EMORB","OIB","UCC","LCC") figAddReservoirs(TRUE,"reservoirs.data",reserv.condition=reserv,labs=reserv.names) ternary("SiO2/10","MgO","FeOt") figAddReservoirs(var.name="idealmins.data",sample.names=c("Or","Bt","Ph")) # spider plots spider(WR,"NMORB..Sun",field=TRUE,colour="gray",field.colour=TRUE,ymin=0.1,ymax=1000) figAddReservoirs(var.name="reservoirs.data",reserv.condition="Continental Crust", autoscale=TRUE,col=c("red","darkred","black","darkblue"),pch=1:3,just.draw=T) figRedraw() # 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") figAddReservoirs(var.name="my.trend",pch="+",col="blue",autoscale=TRUE,type="o", labs=rownames(my.trend)) figXlim(c(10,500)) # But this is again controlled by the argument just.draw binary("Rb","Sr",log="xy") figAddReservoirs(var.name="my.trend",pch="+",col="red",autoscale=TRUE,type="o", labs=rownames(my.trend),just.draw=TRUE) figRedraw()