Skip to content

dreamRs/topogram

Repository files navigation

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.