Cartogram htmlwidget for visualizing geographical data by distorting a TopoJson topology, using cartogram-chart
Install from GitHub:
remotes::install_github("dreamRs/topogram")
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
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.