dreamRs / topogram

R htmlwidget for cartogram-chart

Home Page:https://dreamrs.github.io/topogram/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

topogram

Cartogram htmlwidget for visualizing geographical data by distorting a TopoJson topology, using cartogram-chart

Project Status: Active – The project has reached a stable, usable state and is being actively developed. R-CMD-check Codecov test coverage

Installation

Install from GitHub:

remotes::install_github("dreamRs/topogram")

Overview

Created with:

library(topogram)
world %>% 
  topogram( 
    value = "pop_est", 
    label = "{name}: {format(pop_est, big.mark = ',')}",
    palette = scales::col_bin("viridis", bins = 20, domain = NULL)
  ) %>% 
  topogram_legend(
    title = "Population",
    formatter = scales::label_comma()
  ) %>% 
  topogram_labs(
    title = "World population",
    subtitle = "Population estimate for 2017",
    caption = "Data source: NaturalEarth"
  )

More examples in the {pkgdown} website

Development

This package use {packer} to manage JavaScript assets, see packer's documentation for more.

Install nodes modules with:

packer::npm_install()

Modify srcjs/widgets/topogram.js, then run:

packer::bundle()

Re-install R package and try topogram() functions.

About

R htmlwidget for cartogram-chart

https://dreamrs.github.io/topogram/

License:Other


Languages

Language:R 84.4%Language:JavaScript 14.7%Language:CSS 0.9%