2026-09-09 — Weapon plot colour/dropped-points fixes; widget toolbars hidden

Repos touched: PROJ_activeattack_graphics (b6cc205), PROJ_activeattack_website (a7f60a2 figures, 1f5b89b bob.md + orientation log). Both pushed to main with Peter’s explicit approval; site redeployed via GitHub Actions at 20:09 UTC and verified live.

What Peter asked for

  1. On the Casualties tab, the Fatalities/Wounded by Weapon Type graphic had an arrow annotation (the Waukesha 2021 vehicle case, wounded > 60) shaded like a pistol instead of a vehicle.
  2. Remove the download and fullscreen icons from the top-right of the bicolor map widget; the page has its own download buttons and Peter dislikes the icons’ behaviour. Extended on request to all four interactive widgets.

Diagnosis

  • Arrow colour. fatality_weap_pal is an unnamed 5-colour vector (make_color_blend_multi() returns positional colours). The geom_segment_interactive arrow layer’s data contain only the two over-ceiling cases (Las Vegas 2017, Waukesha 2021), so its scale_color_manual saw two factor levels and assigned the first two palette colours positionally. Waukesha got the pistol colour; Las Vegas happened to get rifle, correctly, by luck. Confirmed by decoding the girafe SVG: Waukesha <line> stroke #C97578 = pistol dot fill, vehicle dots are #697BC8.
  • Dropped points (found while fixing the above). geom_jitter_interactive jittered x as well as y (y is already jittered by hand into weapon_primary_jitter). With scale_x_continuous(limits = c(0, ceiling), expand = c(0,0)), any zero-count event jittered below 0 was removed: 95 rows from the fatalities panel (of 205 events with 0 killed) and 71 from the wounded panel (of 130 with 0 wounded). Which points vanished depended on RNG state, so Hunter’s Windows render and Peter’s Mac render disagreed on dot counts. Pre-existing bug, present on the live site since the plot was created.
  • Toolbar icons. ggiraph ≥ 0.9 moved the download-PNG and fullscreen buttons into the misc toolbar group; opts_toolbar(saveaspng = FALSE) no longer hides them. Fix is hidden = c("selection", "zoom", "misc").

Changes

PROJ_activeattack_graphics/code/plots_cartesian.R, generate_weapon_plot(): - weapon_pal <- setNames(fatality_weap_pal[seq_along(weapon_lvls)], weapon_lvls) with a stopifnot length guard; all three scale calls use it. - Both geom_jitter_interactivegeom_point_interactive. - opts_toolbar(saveaspng = FALSE, hidden = c("selection", "zoom", "misc")) here and in generate_kill_yr_plot(), generate_wound_killed_plot().

PROJ_activeattack_graphics/code/0_packages.R, create_interactive_map(): same opts_toolbar change.

Regenerated: bivar_kill_weapon.{html,png}, bivar_kill_year.html, bivar_wound_kill.html, bicol_map_attackxkilled.html. Static PNGs whose content did not change (bivar_kill_yr.png, bivar_wound_kill.png, bicol_map_attackxkilled.png) were restored/left at Hunter’s versions to avoid byte churn. Rendered with scratch scripts that evaluate only the affected blocks of plots_cartesian.R / plots_geospatial.R (not the full scripts, which also rebuild the gif/mp4).

Copied to PROJ_activeattack_website/www/ (byte-identical, cmp-verified). 0_set_up.R could not be sourced from Rscript because the repo’s renv activates and has no pacman; used plain cp instead — equivalent to update_aa_graphics().

Verification

  • Decoded girafe JSON → SVG for all four widgets: "hidden":["selection","zoom","misc","saveaspng"], zero external _files/ refs, sizes 0.46–0.74 MB (self-contained).
  • Weapon widget: 1,254 circles = 2 × 628 events − 2 (the two > 60-wounded arrow cases, excluded from the wounded axis by design); 628 distinct data-ids. Both arrow strokes match their row’s dot fill.
  • Viewed regenerated PNG: zero columns solid at x = 0 in both panels; vehicle arrow blue.
  • Live after deploy: same checks against https://activeattackdata.org/www/*.html pass.

Environment notes

  • Peter’s Mac: R 4.5.1, ggplot2 4.0.3, ggiraph 0.9.1; Hunter rendered with ggiraph 0.9.6. Widgets from either work; bytes differ. Neither DATA_aa nor graphics has a lockfile.
  • saveWidget(selfcontained = TRUE) leaves a sibling <name>_files/ dir behind each run. Those dirs have been tracked in the graphics repo since 2024-11 and now hold both 0.8.10 and 0.9.4 ggiraph libs (~2 MB dead weight) plus a tracked output/.DS_Store. My render’s girafe-binding-0.9.1 leftovers were deleted before commit. Untracking the folders is a deletion → needs Peter’s approval.
  • pacman auto-installed tidytext on first run (was missing locally).
  • gh CLI is not installed; deploy verified by fetching origin/gh-pages and curling the live widgets.

Open items (carried on bob.md)

  1. Untrack output/*_files/ + output/.DS_Store in graphics; make save_girafe_widget() delete the sibling dir after saving.
  2. Fact-sheet numbers hand-typed; compute from data during the overhaul.
  3. Orphaned files in website data/ and www/.
  4. Pin package versions across the three repos (R runner 4.2.0 / lock 4.3.3 / Mac 4.5.1; ggiraph 0.9.1 vs 0.9.6).
  5. Remove defunct PROJ_activeattack_app (local + GitHub) — needs explicit approval.
  6. Visual overhaul before December 2026 ALERRT conference.

Victims-roster item from the orientation log is closed: Hunter added the 2025 memorial list (62 names, total 1,447) and regenerated the scroll; deployed 19:07 UTC.