figAdd {GCDkit} | R Documentation |
These functions enable adding new components to Figaro-compatible plots.
figTicks(major=-0.5, minor=0.25, xmjr=NULL, xmin=NULL, ymjr=NULL, ymin=NULL) figGrid(x.int=NULL, y.int=NULL, lty="dotted", col="gray30",GUI=FALSE) figLegend(x=NULL,y=NULL,...) figAddReservoirs(autoscale=FALSE, var.name=NULL, sample.names=NULL, reserv.condition=NULL, labs=NULL, pch="*", col="darkred", cex=1, type="p",...) figAddText() figAddArrow() figAddBox() figAddFit(lty="solid",col="black",by.group=FALSE) figAddCurve(equation=NULL)
major |
length of the major tick marks. |
minor |
length of the minor tick marks. |
xmjr, ymjr |
intervals for the major tick marks. |
xmin, ymin |
intervals for the minor tick marks. |
x.int |
intervals for the grid, x axis component. |
y.int |
intervals for the grid, y axis component. |
GUI |
logical; is the function called from GUI? |
x,y |
coordinates for the legend. |
... |
additional parameters to the plotting function. See showLegend and figOverplot, respectively. |
lty |
line type. |
col |
plotting colour. |
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. |
cex |
numeric; relative size of the plotting symbol. |
type |
character; plot type; see plot.default. |
by.group |
logical; should be the linear regression performed by groups? |
equation |
text; equation expressed as a function of x; see curve. |
'figTicks
' adds major and minor tick marks for the x and y axes. Their
length is specified as a fraction of the height of a line of text. Negative
numbers imply outward and positive inward pointing ticks. The user is prompted for
four numbers separated by commas, xmjr, xmin, ymjr, ymin. These specify the intervals
of major and minor ticks for x and y axes, respectively.
Not implemented to logarithmic plots and spiderplots yet.
'figGrid
' adds grid lines for x and/or y axes.
'figLegend
' adds legend(s) on specified location. See legend
and
showLegend
for further details.
'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.
'figAddText
' adds text on specified location. The parameters are the
text style ('n
' = normal, 'b
' = bold, 'i
' = italic and
'bi
' = bold italic), colour and relative size.
'figAddArrow
' adds arrow on specified location. The parameters are
colour and line style ('solid
', 'dashed
', 'dotted
' and
'dotdash
').
'figAddBox
' adds box on specified location (click bottom left and then
top right corner).
'figAddFit
' adds either a single least-squares fit to all data, or
several fit lines, for each of the groups separately. The parameters are colour
and line style ('solid
', 'dashed
', 'dotted
' and
'dotdash
'). If using with GUI, the equation of each fit line is plotted at the user-defined
location.
'figAddCurve
' adds a curve, specified as a function of variable 'x
'.
The parameters are colour and line style ('solid
', 'dashed
',
'dotted
' and 'dotdash
').
The colours can be specified both by their code (see table under menu
'Data handling|Show
available colours
') or R name (see Examples).
The additional two menu items, available for binary and ternary plots, allow adding contours or convex hulls outlining individual groups of data. See contourGroups and chullGroups.
For 'figAddReservoirs
', a numeric matrix with the overplotted analyses
from the reference dataset.
Most of these functions serve to adding some extra components/annotations immediately
before the graph is printed/exported. Note that, except for 'figAddReservoirs
',
all user-defined components added via 'Plot editing: Add
'
will be lost upon redrawing, zooming ....
Colin M. Farrow, colinfarrow537@gmail.com
Vojtěch Janoušek, vojtech.janousek@geology.cz
contourGroups chullGroups legend showLegend
figOverplot figOverplotDiagram overplotDataset curve
data(blatna) accessVar("blatna") setCex(1.5) ## figTicks and figGrid binary("Zr/Nb","Ba/La") figTicks(major=-0.5, minor=0.25,10,1,10,1) figGrid(,5,col="darkblue") # just y axis (second parameter) figRedraw() figGrid(2,5,col="darkblue") ## figLegend groupsByLabel("Suite") figLegend(x="bottomleft",bg="#AAAAAAAA") # Semitransparent ## figAddReservoirs # binary plots binary("Zr/Nb","Ba/La") # Sun & McDonough mantle reservoirs, Taylor & McLennan 1995 Upper and Lower Crust reserv<-c("(MORB|OIB) McDonough","Upper Crust Taylor 1995","Lower Crust Taylor 1995") reserv.names<-c("NMORB","EMORB","OIB","UCC","LCC") figAddReservoirs(autoscale=TRUE,var.name="reservoirs.data",reserv.condition=reserv,labs=reserv.names) # ternary plots plateExtract("Wood",1) reserv<-c("(MORB|OIB) McDonough","Upper Crust Taylor 1995","Lower Crust Taylor 1995") 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","black","darkblue"),pch=1:3) # 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 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()