Mini Charts for Interactive Maps

Add and modify small charts on an interactive map created with package 'leaflet'. These charts can be used to represent at same time multiple variables on a single map.

CRAN_Status_Badge CRAN Downloads Badge Travis-CI Build Status AppVeyor Build Status Coverage Status

For a few years now, it has become easy to create interactive maps with R thanks to the package leaflet by the Rstudio team. Nevertheless, it only provides only a few functions to create basic shapes on a map, so the information that can be represented on a single map is limited: if you have some data associated to some points, you can only represent at most two variables by drawing circles and changing their radius and color according to data.

leaflet.minicharts is an R package that provides two functions to add and update small charts on an interactive maps created with the package leaflet. These charts can be used to represent as many variables as desired associated to geographical points. Currently, three types of chart are supported: barcharts (the default), pie charts and polar area charts.

Here are screenshots of sample outputs:

You can also find a live example here.

Installation and usage

You can install the package from CRAN:


To see how simple it is to use this package, have a look at the package vignette.


Contributions to the library are welcome and can be submitted in the form of pull requests to this repository.

This package contains some javascript code. To modify it requires npm and grunt. First modify files in the javascript folder. Then in a terminal, run the following commands:

cd javascript
npm install
grunt build

License Information:

Copyright 2015-2016 RTE (France)

This Source Code is subject to the terms of the GNU General Public License, version 2 or any higher version. If a copy of the GPL-v2 was not distributed with this file, You can obtain one at


Changes in version 0.5.2 (2017-12-06)


  • update file description
  • Invalid maxValues (0, NA, ...)

Changes in version 0.5.1 (2017-08-17)


  • updateMinicharts() was incapable of updating color palette (#19)

Changes in version 0.5.0 (2017-07-10)


  • addMinicharts() and updateMinicharts() gain a new parameter "onChange" that permits to execute some arbitrary javascript code each time a minichart is updated.
  • The package now uses unit testing, code coverage and continuous integration in order to improve code quality and reliability.


  • Some warnings that appeared with R 3.4 have been removed.
  • Parameter "initialTime" was not working correctly in some situations.
  • Parameter "fillColor" was ignored if someone tried to add a single minicharts.

Changes in version 0.4.0 (2017-06-19)


  • New function syncWith() to synchronize zoom, center and time of multiple leaflet maps.

Changes in version 0.3.1 (2017-05-30)


  • addMinicharts() uses functions that are only available in package leaflet >= 1.1.0. The package now requires this version of leaflet.

Changes in version 0.3 (2017-05-19)


  • Default popups are now automatically generated for charts and flows. A new function "popupArgs()" has been added to control how popups are generated.
  • The size of the JSON data passed from R to javascript has been optimized. In some situations it has been divided by 10, so maps are generated quicker and when they are saved on harddrive, the resulting files are smaller.


  • The default color palette was not found when leaflet.minicharts was imported in another package.
  • add/updateMinicharts/Flows were crashing if layerId was a factor and some levels were missing.
  • Some bugs were occuring if after an update of a map, the number of timesteps increased.

Changes in version 0.2 (2017-05-05)


  • Argument "data" of addMinicharts() and updateMinicharts() has been renamed "chartdata" to avoid confusion with parameter "data" of function leaflet().


  • addMinicharts() now automatically adds a legend to the map by default.
  • addMinicharts() has new parameters "labelMinSize" and "labelMaxSize" to control label size.
  • addMinicharts() has a new parameter "time" that can be used to create an animated map that represents the evolution of one or more variables. Animations can be shared by saving the map as html or including it in a Ramrkdown document. No need to use Shiny anymore!
  • New functions removeMinicharts() and clearMinicharts() to remove some or all minicharts from a map.
  • It is now possible to represent flows between two points with function addFlow() and the associated functions updateFlows(), removeFlows() and clearFlows().


  • addMinicharts was crashing if user tried to add a single chart to a map.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.5.2 by Jalal-Edine ZAWAM, 3 months ago

Browse source code at

Authors: Jalal-Edine ZAWAM [aut, cre], Francois Guillem [aut], RTE [cph]

Documentation:   PDF Manual  

GPL (>= 2) | file LICENSE license

Imports leaflet, htmltools

Suggests knitr, rmarkdown, dplyr, shiny, manipulateWidget, testthat, covr

Imported by lingtypology.

See at CRAN