Skip to content

Instantly share code, notes, and snippets.

@amrrs
Created October 9, 2017 11:03
Show Gist options
  • Save amrrs/bda7042422596027aefd9a654ac1af07 to your computer and use it in GitHub Desktop.
Save amrrs/bda7042422596027aefd9a654ac1af07 to your computer and use it in GitHub Desktop.
Draw a Tree Map of Cryptocurrency Marketcap share
library(coinmarketcapr)
library(treemap)
df <- get_marketcap_ticker_all()
df1 <- na.omit(df[,c('id','market_cap_usd')])
df1$market_cap_usd <- as.numeric(df1$market_cap_usd)
df1$formatted_market_cap <- paste0(df1$id,'\n','$',format(df1$market_cap_usd,big.mark = ',',scientific = F, trim = T))
treemap(df1, index = 'formatted_market_cap', vSize = 'market_cap_usd', title = 'Cryptocurrency Market Cap', fontsize.labels=c(12, 8), palette='RdYlGn')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment