Composite multi-inset atlas layout assembled with image processing
Rendered Map Plate
Map 7: Full multi-inset atlas page showing regional zoom sequence and campus base map
Technical Summary
Objective: Synthesize individual cartographic components into a publication-ready atlas sheet. The top row forms a three-tier geographic zoom sequence (Western US → Bight of California → Extended Campus), anchored below by the panoramic campus base map (Map 6).
Key Packages:magick
Inputs:
images/map3.png (900 x 1200 px, 3x4 in portrait)
images/map4.png (900 x 1200 px, 3x4 in portrait)
images/map5.png (1200 x 900 px, 4x3 in landscape)
images/map6.1.png (3600 x 1200 px, 12x4 in panorama)
Outputs:
Top tryptic row: final_output/map7_row_1.png (4800 x 1200 px)
Complete atlas sheet: final_output/map_07.png (4800 x 2400 px)
The script scripts/map_07.r demonstrates how programmatic image montage workflows in magick can assemble multi-scale atlas plates that exceed standard ggplot facet capabilities.
Step 1: Ingesting Component Map Plates
Four separately compiled graphics are ingested into memory via image_read():
library(magick)# Read the component platesmap3 <-image_read("images/map3.png") # Inset 1: Western US (3x4 in)map4 <-image_read("images/map4.png") # Inset 2: Bight of California (3x4 in)map5 <-image_read("images/map5.png") # Inset 3: Extended Campus (4x3 in)map6 <-image_read("images/map6.1.png") # Bottom Hero: Panoramic Campus (12x4 in)
Input Tile 1: Map 3
Input Tile 2: Map 4
Input Tile 3: Map 5
Step 2: Assembling Row 1 Inset Tryptic
Using image_montage(), Maps 3, 4, and 5 are combined horizontally across a 3x1 grid with centered gravity. Each tile cell is assigned 1600x1200px to maintain consistent vertical alignment across both portrait and landscape inputs.
Finally, the top tryptic row (map7_row1) and the bottom panoramic base map (map6) are stacked vertically across a 1x2 montage grid. The finished plate is stamped with the atlas sheet title using image_annotate().
# Stack row 1 and row 2 into final 2-tier atlas platemap7 <-image_montage(image =c(map7_row1, map6),tile ="1x2",geometry ="4800x1200")map_7_titled <-image_annotate( map7, "Map 7: Where is UCSB?",size =14,location ="+0+0")image_write(map_7_titled, "final_output/map_07.png", format ="png")
Full R Script (scripts/map_07.r)
Show R Code
# Map 7# this is the layout page with 4 maps on it# maps 3 - 4 - 5 zoom in tryptic# and map 6, which is a version of map 1# # clean the environment and hidden objectsrm(list=ls())# Load magick package, which allows to make a montage of imageslibrary(magick)# set map numbercurrent_sheet <-7# set ggplot countercurrent_ggplot <-0# We'll be doing a 12inx9in image, which at 300 PPI is 3600x2700 pixels# Load maps 3, 4, 5, and 6 using the magick::image_read functionmap3 <-image_read("images/map3.png") # 3x4 inches = 900x1200 pixelsmap4 <-image_read("images/map4.png") # 3x4 in = 900x1200 pxmap5 <-image_read("images/map5.png") # 4x3 in = 1200x900 pxmap6 <-image_read("images/map6.1.png") # 12x9 in = 3600x1200 pximage_read("images/map3.png")image_read("images/map4.png")image_read("images/map5.png")image_read("images/map6.1.png")# There are multiple ways to use the magick package to append images,# you could use image_append(), image_montage(), or image_composite()# Let's first make row number 1 or our atlas page, which combines maps 3, 4, and 5"# This will have a geometry of 4800x1200px (12x4 inches), so each tile is 1600x1200map7_row1 <-image_montage(image =c(map3, map4, map5),tile ="3x1",geometry ="1600x1200",gravity ="center")map7_row1# save thatimage_write(map7_row1, "final_output/map7_row_1.png", format ="png")# output itimage_read("final_output/map7_row_1.png")map7 <-image_montage(image =c(map7_row1, map6),tile ="1x2",geometry ="4800x1200")map7map_7_titled <-image_annotate(map7, "Map 7: Where is UCSB?",size =14,location ="+0+0")#save your outputimage_write(map_7_titled, "final_output/map_07.png", format ="png")
Source Code
---title: "Map 7: Atlas Page Layout"subtitle: "Composite multi-inset atlas layout assembled with image processing"---## Rendered Map Plate{fig-alt="Map 7 Composite Layout" width="100%"}---## Technical Summary* **Objective:** Synthesize individual cartographic components into a publication-ready atlas sheet. The top row forms a three-tier geographic zoom sequence (Western US → Bight of California → Extended Campus), anchored below by the panoramic campus base map (Map 6).* **Key Packages:** `magick`* **Inputs:** * `images/map3.png` (900 x 1200 px, 3x4 in portrait) * `images/map4.png` (900 x 1200 px, 3x4 in portrait) * `images/map5.png` (1200 x 900 px, 4x3 in landscape) * `images/map6.1.png` (3600 x 1200 px, 12x4 in panorama)* **Outputs:** * Top tryptic row: `final_output/map7_row_1.png` (4800 x 1200 px) * Complete atlas sheet: `final_output/map_07.png` (4800 x 2400 px)---## Step-by-Step Cartographic Workflow & Intermediate OutputsThe script `scripts/map_07.r` demonstrates how programmatic image montage workflows in `magick` can assemble multi-scale atlas plates that exceed standard `ggplot` facet capabilities.### Step 1: Ingesting Component Map PlatesFour separately compiled graphics are ingested into memory via `image_read()`:```rlibrary(magick)# Read the component platesmap3 <-image_read("images/map3.png") # Inset 1: Western US (3x4 in)map4 <-image_read("images/map4.png") # Inset 2: Bight of California (3x4 in)map5 <-image_read("images/map5.png") # Inset 3: Extended Campus (4x3 in)map6 <-image_read("images/map6.1.png") # Bottom Hero: Panoramic Campus (12x4 in)```::: {.grid}::: {.g-col-12 .g-col-md-4}{fig-alt="Map 3 Inset" width="100%"}:::::: {.g-col-12 .g-col-md-4}{fig-alt="Map 4 Inset" width="100%"}:::::: {.g-col-12 .g-col-md-4}{fig-alt="Map 5 Inset" width="100%"}::::::### Step 2: Assembling Row 1 Inset TrypticUsing `image_montage()`, Maps 3, 4, and 5 are combined horizontally across a `3x1` grid with centered gravity. Each tile cell is assigned `1600x1200px` to maintain consistent vertical alignment across both portrait and landscape inputs.```r# Intermediate montage: 3-panel zoom sequencemap7_row1 <-image_montage(image =c(map3, map4, map5),tile ="3x1",geometry ="1600x1200",gravity ="center")image_write(map7_row1, "final_output/map7_row_1.png", format ="png")```{fig-alt="Map 7 Row 1 Tryptic" width="100%"}### Step 3: Vertical Stacking & Sheet AnnotationFinally, the top tryptic row (`map7_row1`) and the bottom panoramic base map (`map6`) are stacked vertically across a `1x2` montage grid. The finished plate is stamped with the atlas sheet title using `image_annotate()`.```r# Stack row 1 and row 2 into final 2-tier atlas platemap7 <-image_montage(image =c(map7_row1, map6),tile ="1x2",geometry ="4800x1200")map_7_titled <-image_annotate( map7, "Map 7: Where is UCSB?",size =14,location ="+0+0")image_write(map_7_titled, "final_output/map_07.png", format ="png")```---## Full R Script (`scripts/map_07.r`)```{r}#| eval: false#| code: !expr readLines("../scripts/map_07.r")```