Bubble map





This section is dedicated to map with markers displayed on top of it. These markers can be circles with size proportional to a numeric value, resulting in a bubble map. Before exploring this section, learn how to build the map background with R.

Interactive bubble maps with leaflet

The leaflet R package is a wrapper of the Javascript leaflet.js library. It allows to build stunning interactive maps in minutes with R. Maps can be exported and standalong html files, or be embeded in a R markdown file or a shiny application. Check the 3 examples below to get the basics of interactive bubble maps with R.

Leaflet maps are interactive. Try to zoom and drag the map below. Hover a circle to get more information about it. See Code

See Code



Static bubble maps with ggplot2

ggplot2 is probably the best option if you're looking to build a static bubble map. It offers all the flexibility of the grammar of graphic, and allow to re-use all the knowledge you learned building other types of chart with it. If you don't know about ggplot2, read this introduction.





Interactive bubble map with ggplot2 and plotly

The plotly package provides the magic ggplotly() function. This function will turn any of your static bubble map made with ggplot2 interactive. With only one more line of code:

See Code

Note: try to zoom, drag, hover circle, select area and more.




Bubble map with the cartography package.

The cartography package is a great alternative to the tidyverse to build maps with R. It provides many helpers specially made for maps.

Related chart types


Map
Choropleth
Hexbin map
Cartogram
Connection
Bubble map