useR! 2018 feature wall

Creating the hexmap feature wall for useR! 2018

Mitchell O’Hara-Wild


July 11, 2018


May 1, 2024

The hexwall at useR! 2018 features roughly 200 contributed R package hexagon stickers. If you’ve ever had difficulty aligning hexagon stickers in your slides or even on your laptop, you may appreciate the challenge of arranging hundreds of hexagons. Fortunately with R and a little bit of magick, we can substantially simplify this process.


Hexagon collection proved to be one of the more time-consuming steps in the project. Without a Comprehensive R Hexagon Repository (CRHR), Di Cook (@visnut) and I resorted to collecting hexagons via email and promoting the project via twitter.

Our collection efforts were also supported by Rstudio’s hex-stickers and Bioconductor’s BiocStickers repositories. We opted not to sift through the library as we wanted the feature wall to feature only R package stickers.

The response to our project has been huge, and we are grateful for everyone who has contributed their stickers.


The hexwall script (available at mitchelloharawild/hexwall) provides the magick for cleaning, sorting, and arranging hexagons. The function does the following operations using the ROpenSci magick package:

  • Load the images
  • Make white backgrounds transparent
  • Trim images
  • Remove bad images (low resolution or incorrect dimensions)
  • Arrange the stickers on the canvas

For more details on using magick to arrange hexagons, you can read arranging hex stickers in R

Creating the hex map

To create a hexagon map of Australia, we first need to find a map. I’m using the GADM database to give a nice boundary of Australia, which is easily obtainable via the raster package.

aus <- getData("GADM", country = "AUS", level = 0) %>%
  disaggregate() %>%
#> Warning in getData("GADM", country = "AUS", level = 0): getData will be removed in a future version of raster
#> . Please use the geodata package instead
#> Warning in explodePolygons(x, ...): No rgeos support in sp from October 2023;
#> see
ggplot() + 
  geom_sf(data = st_as_sf(aus))

To convert this map into hexagonal coordinates, we can use the spsample function to sample a hexagonal lattice. Through experimentation, a cellsize of 2 is roughly appropriate for the number of hexagons submitted to us. As it is a random process, some repetition may be needed to get the exact number of hexagons on the map with a nice layout.

hex_points <- aus %>%
  spsample(type = "hexagonal", cellsize = 2)

#> # A tibble: 201 x 2
#>        x     y
#>    <dbl> <dbl>
#>  1  146. -43.3
#>  2  145. -41.6
#>  3  147. -41.6
#>  4  141. -38.1
#>  5  143. -38.1
#>  6  145. -38.1
#>  7  147. -38.1
#>  8  140. -36.4
#>  9  142. -36.4
#> 10  144. -36.4
#> # i 191 more rows

To ensure that we are happy with the hexagon placements, we should view the hexagon grid on a map. We can convert our coordinates to hexagonal polygons using HexPoints2SpatialPolygons, and then plot them on the map.

aus_hex <- HexPoints2SpatialPolygons(hex_points, dx = 2)

ggplot() + 
  geom_sf(data = st_as_sf(aus)) + 
  geom_sf(data = st_as_sf(aus_hex), colour = "blue", fill = NA)

Looks great, let’s make the map. Using the script from mitchelloharawild/hexwall, we provide:

  • A folder containing the hexagon images
  • Desired pixel width of each hexagon
  • Hexagon coordinates computed above

If there are lot of stickers to position, or the resulting image dimension is large, this may take some time.

  sticker_width = 500,
  coords = hex_points@coords,
  sort_mode = "colour"

Beyond that, there were just a few finishing touches needed to add the useR! 2018 logo and text. Hope you all enjoy the 2018 useR! conference :)


BibTeX citation:
  author = {O’Hara-Wild, Mitchell},
  title = {useR! 2018 Feature Wall},
  date = {2018-07-11},
  url = {},
  langid = {en}
For attribution, please cite this work as:
O’Hara-Wild, Mitchell. 2018. “useR! 2018 Feature Wall.” July 11, 2018.