5

I've read the DT.pdf doc and searched, but it seems like different colors is not supported by DT package. How could I achieve the effect shown in the image link below? Thanks!

example: different colors for positive and negative values

Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
Jim Green
  • 261
  • 4
  • 10
  • 1
    By DT.pdf, if you mean the R package manual pages, don't read it. It is almost useless. Please read the website instead, e.g. http://rstudio.github.io/DT/functions.html – Yihui Xie Sep 28 '15 at 21:19
  • I've read rstudio.github.io/DT/functions.html http://rstudio.github.io/DT/010-style.html and have used many great tricks in these docs. Hoewever, the styleColorBar examples only use one color. Does styleColorBar accept two colors as argument and depending on the sign of the value, it decides which one to use? Thanks for such a great package btw. – Jim Green Sep 28 '15 at 21:39
  • 1
    That is right. `styleColorBar()` does not support different colors. You will have to fall back to JavaScript, but I don't have time to write the JS code for you at the moment. – Yihui Xie Sep 29 '15 at 04:15
  • 1
    Thanks, styleColorBar multi color support would be nice feature:) – Jim Green Sep 29 '15 at 14:58
  • 4
    You can look at this question: http://stackoverflow.com/questions/33521828/r-dt-stylecolorbar-center-and-shift-left-right-dependent-on-sign/33524422#33524422 – NicE Dec 12 '15 at 15:46
  • I deleted my answer because the answer linked by NicE is 100x better. Thanks for a good solution btw. – Pekka Dec 29 '15 at 14:49

0 Answers0