Customising map appearance

In this article we will describe different ways to customise the appearance of an antigenic map with for example different point colours, shapes and sizes. We’ll first describe the key functions and then go through an example.

Main point style functions

The main functions for controlling point style parameters are:

Note that the primary supported shapes values are “circle”, “box” and “triangle”, but see below for details on further map customisation.

There is also the function ptDrawingOrder() which controls the order in which points are plotted according to their index in the map (numbering the antigens first then the sera).

An example of styling a map

map <- read.acmap(system.file("extdata/h3map2004.ace", package = "Racmacs"))

# Rotate the map
map <- rotateMap(map, 210)

# Colour all the antigens grey
agFill(map) <- "grey50"

# Colour all the vaccine antigens in red and increase their size
vaccine_strains <- c(

vaccine_ags <- agNames(map) %in% vaccine_strains
agFill(map)[vaccine_ags] <- "red"
agSize(map)[vaccine_ags] <- 8

# Bring the antigens to the top of the plot
ptDrawingOrder(map) <- c(
  seq_len(numSera(map)) + numAntigens(map), # Draw sera first
  which(!vaccine_ags),                      # Then draw non vaccine ags
  which(vaccine_ags)                        # The draw vaccine ags
# Plot the map