plotlegend {DASplusR} | R Documentation |
The function 'plotlegend()' adds a legend to an existing plot.
plotlegend(dataset,x,y,var,type=c("percentile","absolute"), qutiles,legend.title="",psymb=c(1,1,16,3,3), ssize=c(1.3,0.9,0.5,0.9,1.3),scolor=c(1,1,1,1,1), leg.position.x,leg.position.y, leg.title.cex=0.8, leg.round=2, leg.just="right",xMin=NA,xMax=NA,yMin=NA,yMax=NA)
dataset |
a data object of class 'DASData' or 'data.frame' |
x |
character; the object name of the x-coordinate |
y |
character; the object name of the y-coordinate |
var |
character; the object name of the spatial variable |
type |
character; "absolute" or "percentile" |
qutiles |
numeric; if type is 'relative' the percentiles for the levels, if type is 'absolute' the level values |
legend.title |
character; a string specifying the legend title |
psymb |
numeric; a vector of plotting character (0-311) to be used for generating the legend, recycled if necessary |
ssize |
numeric; a vector of the size of the symbols to be used for generating the legend, recycled if necessary |
scolor |
numeric; a vector of the colors of the symbols to be used for generating the legend, recycled if necessary |
leg.position.x |
numeric; x-coordinate of the legend |
leg.position.y |
numeric; y-coordinate of the legend |
leg.title.cex |
numeric; a numerical value giving the amount by which legend title should be scaled relative to the default |
leg.round |
numeric; number of digits of the legend values |
leg.just |
character; "left", "right" or "center" specifying the justification |
xMin |
numeric; value for the lower bound of the x-coordinate or NA for no boundary |
xMax |
numeric; value for the upper bound of the x-coordinate or NA for no boundary |
yMin |
numeric; value for the lower bound of the y-coordinate or NA for no boundary |
yMax |
numeric; value for the upper bound of the y-coordinate or NA for no boundary |
The function 'plotlegend()' adds a legend with symbols specified through psymb, ssize and scolor at the location specified with leg.position.x and leg.position.y.
If type is 'absolute' the borders of the classes are given by the vector 'qutiles' including the class less then the first value and the class greater then the last value.
If type is "relative" the classes are calculated from the percentages given by qutiles.
If any boundary of the coordinates given by xMin,xMax, yMin, yMax the legend is calculated from the remaining values.
'plotlegend','growingDotLegend','SmoothLegend'
require(DASplusR7) DefaultSymbolSets() data(KOLA95_C2MM) map(dataset=KOLA95_C2MM,x="XCOO",y="YCOO",var="Al",level="Percentile", levelvalues=c(0,50,75,100),symbolset="EDA",title="",xlabel="", ylabel="", cex.xlab = "1",cex.ylab="1", font.xlab="1", font.ylab="1", margin=c(5,4,4,2)+0.1, xMin=NA, xMax=NA, yMin=NA, yMax=NA,x.grid=FALSE, x.grid.type=1,x.grid.color=1, x.grid.width=1,y.grid=FALSE,y.grid.type=1, y.grid.color=1, y.grid.width=1, x.log=FALSE, y.log=FALSE, frame=TRUE) axis(1,labels=TRUE,font=1,cex.axis=1) axis(2,labels=TRUE,font=1,cex.axis=1) plotlegend(dataset=KOLA95_C2MM,x="XCOO",y="YCOO",var="Al", type="percentile", qutiles=c(0,0.5,0.75,1), legend.title="Al [mg/kg]",psymb=c(286,286,305,288), ssize=c(1.99,1.42,0.3,1), scolor=c("black","black","black","black"), leg.position.x=725398,leg.position.y=7876693,leg.title.cex=0.8, xMin=NA,xMax=NA,yMin=NA,yMax=NA)