Skip to content

Commit

Permalink
added color palettes with 20 and 269 max different colors
Browse files Browse the repository at this point in the history
  • Loading branch information
jo committed Jul 21, 2015
1 parent 6a5008c commit 2cc6de6
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions R/Arena.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#color dictionary of 269 maximally distinct colors from all previous colors
colpal1 <- c("#000000","#FFFF00","#1CE6FF","#FF34FF","#FF4A46","#008941","#006FA6","#A30059","#FFDBE5","#7A4900","#0000A6","#63FFAC","#B79762","#004D43","#8FB0FF","#997D87","#5A0007","#809693","#FEFFE6","#1B4400","#4FC601","#3B5DFF","#4A3B53","#FF2F80","#61615A","#BA0900","#6B7900","#00C2A0","#FFAA92","#FF90C9","#B903AA","#D16100","#DDEFFF","#000035","#7B4F4B","#A1C299","#300018","#0AA6D8","#013349","#00846F","#372101","#FFB500","#C2FFED","#A079BF","#CC0744","#C0B9B2","#C2FF99","#001E09","#00489C","#6F0062","#0CBD66","#EEC3FF","#456D75","#B77B68","#7A87A1","#788D66","#885578","#FAD09F","#FF8A9A","#D157A0","#BEC459","#456648","#0086ED","#886F4C","#34362D","#B4A8BD","#00A6AA","#452C2C","#636375","#A3C8C9","#FF913F","#938A81","#575329","#00FECF","#B05B6F","#8CD0FF","#3B9700","#04F757","#C8A1A1","#1E6E00","#7900D7","#A77500","#6367A9","#A05837","#6B002C","#772600","#D790FF","#9B9700","#549E79","#FFF69F","#201625","#72418F","#BC23FF","#99ADC0","#3A2465","#922329","#5B4534","#FDE8DC","#404E55","#0089A3","#CB7E98","#A4E804","#324E72","#6A3A4C","#83AB58","#001C1E","#D1F7CE","#004B28","#C8D0F6","#A3A489","#806C66","#222800","#BF5650","#E83000","#66796D","#DA007C","#FF1A59","#8ADBB4","#1E0200","#5B4E51","#C895C5","#320033","#FF6832","#66E1D3","#CFCDAC","#D0AC94","#7ED379","#012C58","#7A7BFF","#D68E01","#353339","#78AFA1","#FEB2C6","#75797C","#837393","#943A4D","#B5F4FF","#D2DCD5","#9556BD","#6A714A","#001325","#02525F","#0AA3F7","#E98176","#DBD5DD","#5EBCD1","#3D4F44","#7E6405","#02684E","#962B75","#8D8546","#9695C5","#E773CE","#D86A78","#3E89BE","#CA834E","#518A87","#5B113C","#55813B","#E704C4","#00005F","#A97399","#4B8160","#59738A","#FF5DA7","#F7C9BF","#643127","#513A01","#6B94AA","#51A058","#A45B02","#1D1702","#E20027","#E7AB63","#4C6001","#9C6966","#64547B","#97979E","#006A66","#391406","#F4D749","#0045D2","#006C31","#DDB6D0","#7C6571","#9FB2A4","#00D891","#15A08A","#BC65E9","#FFFFFE","#C6DC99","#203B3C","#671190","#6B3A64","#F5E1FF","#FFA0F2","#CCAA35","#374527","#8BB400","#797868","#C6005A","#3B000A","#C86240","#29607C","#402334","#7D5A44","#CCB87C","#B88183","#AA5199","#B5D6C3","#A38469","#9F94F0","#A74571","#B894A6","#71BB8C","#00B433","#789EC9","#6D80BA","#953F00","#5EFF03","#E4FFFC","#1BE177","#BCB1E5","#76912F","#003109","#0060CD","#D20096","#895563","#29201D","#5B3213","#A76F42","#89412E","#1A3A2A","#494B5A","#A88C85","#F4ABAA","#A3F3AB","#00C6C8","#EA8B66","#958A9F","#BDC9D2","#9FA064","#BE4700","#658188","#83A485","#453C23","#47675D","#3A3F00","#061203","#DFFB71","#868E7E","#98D058","#6C8F7D","#D7BFC2","#3C3E6E","#D83D66","#2F5D9B","#6C5E46","#D25B88","#5B656C","#00B57F","#545C46","#866097","#365D25","#252F99","#00CCFF","#674E60","#FC009C","#92896B")

# 20 optimally distinct colors
colpal2 <- c("#C48736", "#CE54D1", "#96CED5", "#76D73C", "#403552", "#D4477D", "#5A7E36", "#D19EC4", "#CBC594", "#722A2D", "#D0CD47", "#CF4A31", "#7B6FD0", "#597873", "#6CD3A7", "#484125", "#C17E73", "#688EC1", "#844081", "#7DD06F")



########################################################################################################
###################################### Arena CLASS ################################################
########################################################################################################
Expand Down Expand Up @@ -935,6 +943,7 @@ setMethod("plotCurves", "Eval", function(object, medplot=object@mediac, retdata=

setGeneric("plotCurves2", function(object, legendpos="topleft", num=10){standardGeneric("plotCurves2")})
setMethod("plotCurves2", "Eval", function(object, legendpos="topright", num=10){
if(num>length(object@mediac) || num<1) stop("Number of substances invalid")
# first get the correct (ie. complete) medlist
prelist <- lapply(seq_along(object@medlist), function(i){extractMed(object, i)})
list <- lapply(prelist, function(x){lapply(x, sum)})
Expand All @@ -943,7 +952,7 @@ setMethod("plotCurves2", "Eval", function(object, legendpos="topright", num=10){
mat_var <- rowSums((mat - rowMeans(mat))^2)/(dim(mat)[2] - 1)
mat_nice <- tail(mat[order(mat_var),], num)

cols <- seq(num)
if(num>length(colpal2)) cols <- colpal1[1:num] else cols <- colpal2[1:num]
matplot(t(mat_nice), type='l', col=cols, pch=1, lty=1,
xlab='time in h', ylab='concentration in mmol',
main='Strongly changing substances')
Expand All @@ -956,19 +965,21 @@ setMethod("plotCurves2", "Eval", function(object, legendpos="topright", num=10){
#' @description The generic function \code{plotTotFlux} plots the time course of reactions with high variation in activity for an \code{Eval} object.
#'
#' @param object An object of class Eval.
setGeneric("plotTotFlux", function(object, legendpos="topright"){standardGeneric("plotTotFlux")})
setMethod("plotTotFlux", "Eval", function(object, legendpos="topright"){
setGeneric("plotTotFlux", function(object, legendpos="topright", num=20){standardGeneric("plotTotFlux")})
setMethod("plotTotFlux", "Eval", function(object, legendpos="topright", num=20){
if(num<1) stop("Number of reactions invalid")
list <- lapply(object@mfluxlist, function(x){
unlist(x)
})
mat <- do.call(cbind, list)
mat_var <- rowSums((mat - rowMeans(mat))^2)/(dim(mat)[2] - 1)
mat_nice <- tail(mat[order(mat_var),], 20)
mat_nice <- tail(mat[order(mat_var),], num)

matplot(t(mat_nice), type='l', pch=1, lty=1,
if(num>length(colpal2)) cols <- colpal1[1:num] else cols <- colpal2[1:num]
matplot(t(mat_nice), type='l', col=cols, pch=1, lty=1,
xlab='time in h', ylab='reaction activity in mmol/(h * g_DW)',
main='Highly active reactions')
legend(legendpos, rownames(mat_nice), col=seq_len(nrow(mat_nice)), cex=0.5, fill=seq_len(nrow(mat_nice)))
legend(legendpos, rownames(mat_nice), col=cols, cex=0.5, fill=cols)
})


Expand Down

0 comments on commit 2cc6de6

Please sign in to comment.