{"spec_id":"strip-basic","library":"ggplot2","language":"r","code":"#' anyplot.ai\n#' strip-basic: Basic Strip Plot\n#' Library: ggplot2 3.5.1 | R 4.4.1\n#' Quality: 92/100 | Created: 2026-08-05\n\nlibrary(ggplot2)\nlibrary(ragg)\n\nset.seed(42)\n\n# Theme tokens (see prompts/default-style-guide.md \"Background\" + \"Theme-adaptive Chrome\")\nTHEME       <- Sys.getenv(\"ANYPLOT_THEME\", \"light\")\nPAGE_BG     <- if (THEME == \"light\") \"#FAF8F1\" else \"#1A1A17\"\nINK         <- if (THEME == \"light\") \"#1A1A17\" else \"#F0EFE8\"\nINK_SOFT    <- if (THEME == \"light\") \"#4A4A44\" else \"#B8B7B0\"\nIMPRINT_PALETTE <- c(\"#009E73\", \"#C475FD\", \"#4467A3\", \"#BD8233\",\n                     \"#AE3030\", \"#2ABCCD\", \"#954477\", \"#99B314\")\n\n# Data: time to symptom relief across drug trial groups\ngroups <- c(\"Placebo\", \"Drug A\", \"Drug B\", \"Drug C\")\ngroup_means <- c(58, 41, 33, 27)\ngroup_sds   <- c(14, 12, 10, 9)\ngroup_n     <- c(70, 70, 70, 70)\n\ndf <- do.call(rbind, lapply(seq_along(groups), function(i) {\n  data.frame(\n    group = groups[i],\n    minutes = pmax(5, rnorm(group_n[i], mean = group_means[i], sd = group_sds[i]))\n  )\n}))\ndf$group <- factor(df$group, levels = groups)\n\n# Plot\np <- ggplot(df, aes(x = group, y = minutes, color = group)) +\n  geom_jitter(width = 0.18, size = 2.5, alpha = 0.6, show.legend = FALSE) +\n  stat_summary(fun = mean, geom = \"crossbar\", width = 0.5,\n               color = INK_SOFT, linewidth = 0.5, fatten = 1) +\n  stat_summary(\n    aes(label = after_stat(sprintf(\"%.0f min\", y))),\n    fun = mean, geom = \"text\", color = INK, size = 3,\n    fontface = \"bold\", hjust = 0, vjust = 0.5,\n    position = position_nudge(x = 0.32), show.legend = FALSE\n  ) +\n  scale_color_manual(values = IMPRINT_PALETTE) +\n  labs(\n    x = \"Treatment Group\",\n    y = \"Time to Symptom Relief (minutes)\",\n    title = \"strip-basic · r · ggplot2 · anyplot.ai\"\n  ) +\n  theme_minimal(base_size = 8) +\n  theme(\n    plot.background   = element_rect(fill = PAGE_BG, color = PAGE_BG),\n    panel.background  = element_rect(fill = PAGE_BG, color = NA),\n    panel.grid.major.x = element_blank(),\n    panel.grid.minor  = element_blank(),\n    panel.grid.major.y = element_line(color = INK, linewidth = 0.3),\n    axis.title        = element_text(color = INK, size = 10),\n    axis.text         = element_text(color = INK_SOFT, size = 8),\n    axis.ticks        = element_blank(),\n    plot.title        = element_text(color = INK, size = 12)\n  )\n\n# Save\nggsave(\n  filename = sprintf(\"plot-%s.png\", THEME),\n  plot     = p,\n  device   = ragg::agg_png,\n  width    = 8,\n  height   = 4.5,\n  units    = \"in\",\n  dpi      = 400\n)\n"}