Skip to content

Instantly share code, notes, and snippets.

@renkun-ken
Created June 20, 2016 04:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renkun-ken/ae0b17402522386ae1f09a24b26cd449 to your computer and use it in GitHub Desktop.
Save renkun-ken/ae0b17402522386ae1f09a24b26cd449 to your computer and use it in GitHub Desktop.
formattable: color bar + color text
library(formattable)
data <- data.frame(id = 1:10, x = rbinom(10, 100, 0.8))
formattable(data, list(x = formatter("span",
style = x ~ style(
display = "inline-block",
direction = "rtl",
"border-radius" = "4px",
"padding-right" = "2px",
"background-color" = csscolor("lightgray"),
width = percent(proportion(x)),
color = csscolor(gradient(x, "darkgreen", "red"))
))))
@brainprint
Copy link

Thanks for your demo. It has helped me a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment