ObjFctColours {ModelDataComp} | R Documentation |
The function computes class breaks and colour palettes for ObjFct
metrics
ObjFctColours(x, which = NULL, cols = NULL, ...)
x |
Either an object of class |
which |
which objective function metric should be used to create colours and class breaks? |
cols |
vector of colours that should be used |
... |
further arguments (not used) |
No details.
A list with class breaks and colours
Matthias Forkel <matthias.forkel@geo.tuwien.ac.at> [aut, cre]
No reference.
# create some data and compute objective functions obs <- 1:100 # 'observations' sim <- obs * c(rnorm(25, 1, 0.2), rnorm(25, 1, 0.5), rnorm(25, 1.5, 1), rnorm(25, -0.3, 0.3)) groups <- c(rep("subset 1", 25), rep("subset 2", 25), rep("subset 3", 25), rep("subset 4", 25)) ScatterPlot(obs, sim, groups) of <- ObjFct(sim, obs, groups=groups) of # create colours and class breaks: default for correlation cols <- ObjFctColours(of) barplot(of[["Cor"]], col=cols$cols) legend("topright", as.character(cols$x), fill=cols$cols, title="Colour for each value") legend("topleft", as.character(cols$brks[-1]), fill=cols$cols0, title="Colour palette") # create colours and class breaks for RMSE cols <- ObjFctColours(of, "RMSE") barplot(of[["RMSE"]], col=cols$cols) legend("top", as.character(cols$x), fill=cols$cols, title="Colour for each value") legend("topleft", as.character(cols$brks[-1]), fill=cols$cols0, title="Colour palette") # create colours and class breaks based on vectors ioa <- of[["IoA"]] cols <- ObjFctColours(ioa, "IoA") barplot(ioa, col=cols$cols) legend("topright", as.character(cols$x), fill=cols$cols, title="Colour for each value") legend("topleft", as.character(cols$brks[-1]), fill=cols$cols0, title="Colour palette") # use different colours cols <- ObjFctColours(ioa, "IoA", cols=c("red", "green", "blue")) barplot(ioa, col=cols$cols) legend("topright", as.character(cols$x), fill=cols$cols, title="Colour for each value") legend("topleft", as.character(cols$brks[-1]), fill=cols$cols0, title="Colour palette")