Description Usage Arguments Details Author(s) Examples
Given a vector of feature statuses (and optional positions), return a vector of associated colors, reflecting their status, and optionally the local density (densCols).
1 2 3 4 5 6 7 8 | featureColors(feature.status, positions = NULL, status.colors = c(default =
"grey", light.dens = "#8888FF", dark.dens = "#FF6666", positive = "#4455DD",
positive.light = "#4466FF", positive.dense = "#2244BB", negative = "#888888",
negative.light = "#BBBBBB", negative.dense = "#222222", TP = "#00DD00",
TP.light = "#00FF00", TP.dense = "#004400", TN = "#00CCFF", TN.light =
"#00FFFF", TN.dense = "#004444", FP = "#FF0000", FP.light = "#FF0000",
FP.dense = "#440000", FN = "#FF6600", FN.light = "#FFCC22", FN.dense =
"#BB4411", alpha = "#BB2222", points = "#BBBBBB"))
|
feature.status |
vector of strings, each value indicating a status (e.g. "positive", "negative", "TP", "FP", "TN", "TP"). |
positions=NULL |
data frame indicating the position of each feature, which is passed to densCols() in order to tune the color according to local density of features. This requires to have defined, for each status, two colors named status.light and status.dens (e.g. "positive.light", "positive.dens" if the status is positive). |
status.colors=c("default"="grey", "light.dens"="#8888FF", "dark.dens"="#FF6666", "positive"='#4455DD', |
"positive.light" = '#88CCFF', "positive.dense" = "#2244BB","negative"="#BBBB00", "negative.light" = "#DDDD00", "negative.dense" = "#666600","TP"="#00DD00", "TP.light" = "#00FF00", "TP.dense" = "#004400","TN"="#888888", "TN.light" = "#CCCCCC", "TN.dense" = "#444444","FP"="#FF0000", "FP.light" = "#FF8888", "FP.dense" = "#880000","FN"="#FF8822", "FN.light"="#FFCC44", "FN.dense" = "#884411","alpha"="#BB2222","points"="#BBBBBB") Vector of colors associated to typical statuses. |
First version: 2015-11 Last modification: 2015-11
Jacques van Helden (Jacques.van-Helden@univ-amu.fr)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Create features with status-specific distributions of positions
TP <- data.frame(x=rnorm(n=2000, mean=0, sd=1), y=rnorm(n=1000, mean=0, sd=1), status="TP")
FP <- data.frame(x=rnorm(n=2000, mean=3, sd=1), y=rnorm(n=1000, mean=0, sd=1), status="FP")
FN <- data.frame(x=rnorm(n=2000, mean=0, sd=1), y=rnorm(n=1000, mean=3, sd=1), status="FN")
TN <- data.frame(x=rnorm(n=2000, mean=3, sd=1), y=rnorm(n=1000, mean=3, sd=1), status="TN")
features <- rbind(TP, TN, FP, FN)
table(features$status)
## Assign colors according to status, irrespective of position
features$color <- featureColors(features$status)
table(features$status, features$color)
plot(features$x, features$y, col=features$color)
features$color <- featureColors(features$status, positions=features[, c("x", "y")])
plot(features$x, features$y, col=features$color)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.