diff --git a/plots/venn-labeled-items/implementations/r/ggplot2.R b/plots/venn-labeled-items/implementations/r/ggplot2.R new file mode 100644 index 0000000000..34d9de70c8 --- /dev/null +++ b/plots/venn-labeled-items/implementations/r/ggplot2.R @@ -0,0 +1,134 @@ +#' anyplot.ai +#' venn-labeled-items: Chartgeist-Style Venn Diagram with Labeled Items +#' Library: ggplot2 3.5.1 | R 4.4.1 +#' Quality: 86/100 | Created: 2026-06-25 + +library(ggplot2) +library(dplyr) +library(ragg) + +set.seed(42) + +# Theme tokens +THEME <- Sys.getenv("ANYPLOT_THEME", "light") +PAGE_BG <- if (THEME == "light") "#FAF8F1" else "#1A1A17" +INK <- if (THEME == "light") "#1A1A17" else "#F0EFE8" +INK_SOFT <- if (THEME == "light") "#4A4A44" else "#B8B7B0" +INK_MUTED <- if (THEME == "light") "#6B6A63" else "#A8A79F" + +# Imprint palette — circles use first 3 positions +IMPRINT_PALETTE <- c("#009E73", "#C475FD", "#4467A3", "#BD8233", + "#AE3030", "#2ABCCD", "#954477", "#99B314") + +# Circle geometry: symmetric equilateral triangle layout +r <- 2.5 +d <- 2.5 + +cx_a <- 0; cy_a <- d / sqrt(3) +cx_b <- -d / 2; cy_b <- -d / (2 * sqrt(3)) +cx_c <- d / 2; cy_c <- -d / (2 * sqrt(3)) + +# Circle coordinates — inlined +theta <- seq(0, 2 * pi, length.out = 361) +circ_a <- data.frame(x = cx_a + r * cos(theta), y = cy_a + r * sin(theta)) +circ_b <- data.frame(x = cx_b + r * cos(theta), y = cy_b + r * sin(theta)) +circ_c <- data.frame(x = cx_c + r * cos(theta), y = cy_c + r * sin(theta)) + +# Tech trends 2025 items per zone +items <- data.frame( + label = c( + "Metaverse", "Web3", "AI Pin", "Crypto Wallet", + "Markdown", "Obsidian", "1Password", + "YouTube", "Chrome", "WhatsApp", + "GPT-4", "Copilot", + "TikTok", "Threads", + "Google Maps", "Notion", "Spotify", + "ChatGPT", "iPhone" + ), + zone = c( + rep("A", 4), rep("B", 3), rep("C", 3), + rep("AB", 2), rep("AC", 2), rep("BC", 3), rep("ABC", 2) + ), + stringsAsFactors = FALSE +) + +# Zone anchor centers (hand-tuned for r=2.5, d=2.5 equilateral layout) +zone_anchors <- data.frame( + zone = c("A", "B", "C", "AB", "AC", "BC", "ABC"), + ax = c(0.00, -2.30, 2.30, -1.20, 1.20, 0.00, 0.00), + ay = c(2.90, -1.70, -1.70, 0.85, 0.85, -1.55, 0.15), + stringsAsFactors = FALSE +) + +# Spread items vertically within each zone +items <- items %>% + left_join(zone_anchors, by = "zone") %>% + group_by(zone) %>% + mutate( + idx = row_number(), + n_zone = n(), + y_off = (idx - (n_zone + 1) / 2) * 0.52, + lx = ax, + ly = ay + y_off + ) %>% + ungroup() + +# Title (64 chars <= 67 baseline — use full 12pt) +plot_title <- "Tech Trends 2025 · venn-labeled-items · r · ggplot2 · anyplot.ai" + +# Assemble plot +p <- ggplot() + + # Semi-transparent circle fills (drawn back-to-front so overlaps blend) + geom_polygon(data = circ_a, aes(x, y), fill = IMPRINT_PALETTE[1], alpha = 0.13, color = NA) + + geom_polygon(data = circ_b, aes(x, y), fill = IMPRINT_PALETTE[2], alpha = 0.13, color = NA) + + geom_polygon(data = circ_c, aes(x, y), fill = IMPRINT_PALETTE[3], alpha = 0.13, color = NA) + + # Circle outlines + geom_path(data = circ_a, aes(x, y), color = IMPRINT_PALETTE[1], linewidth = 1.1) + + geom_path(data = circ_b, aes(x, y), color = IMPRINT_PALETTE[2], linewidth = 1.1) + + geom_path(data = circ_c, aes(x, y), color = IMPRINT_PALETTE[3], linewidth = 1.1) + + # Item labels inside zones + geom_text( + data = items, + aes(x = lx, y = ly, label = label), + color = INK, + size = 3.2, + fontface = "plain" + ) + + # Category names positioned outside each circle + annotate("text", x = 0, y = cy_a + r + 0.65, + label = "Buzzworthy", color = IMPRINT_PALETTE[1], + size = 4.0, fontface = "bold", hjust = 0.5, family = "serif") + + annotate("text", x = cx_b - 0.4, y = cy_b - r - 0.60, + label = "Actually Useful", color = IMPRINT_PALETTE[2], + size = 4.0, fontface = "bold", hjust = 1.0, family = "serif") + + annotate("text", x = cx_c + 0.4, y = cy_c - r - 0.60, + label = "Everyone Uses It", color = IMPRINT_PALETTE[3], + size = 4.0, fontface = "bold", hjust = 0.0, family = "serif") + + coord_fixed( + xlim = c(-5.5, 5.5), + ylim = c(-6.5, 5.5) + ) + + labs(title = plot_title) + + theme_void() + + theme( + plot.background = element_rect(fill = PAGE_BG, color = PAGE_BG), + panel.background = element_rect(fill = PAGE_BG, color = NA), + plot.title = element_text( + color = INK_MUTED, + size = 12, + hjust = 0.5, + margin = margin(t = 8, b = 4) + ), + plot.margin = margin(15, 15, 15, 15) + ) + +# Save — square canvas: 6 x 6 in * 400 dpi = 2400 x 2400 px +ggsave( + filename = sprintf("plot-%s.png", THEME), + plot = p, + device = ragg::agg_png, + width = 6, + height = 6, + units = "in", + dpi = 400 +) diff --git a/plots/venn-labeled-items/metadata/r/ggplot2.yaml b/plots/venn-labeled-items/metadata/r/ggplot2.yaml new file mode 100644 index 0000000000..0ac66fff27 --- /dev/null +++ b/plots/venn-labeled-items/metadata/r/ggplot2.yaml @@ -0,0 +1,280 @@ +library: ggplot2 +language: r +specification_id: venn-labeled-items +created: '2026-06-25T11:42:28Z' +updated: '2026-06-25T11:59:13Z' +generated_by: claude-sonnet +workflow_run: 28166836998 +issue: 5364 +language_version: 4.4.1 +library_version: 3.5.1 +preview_url_light: https://storage.googleapis.com/anyplot-images/plots/venn-labeled-items/r/ggplot2/plot-light.png +preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/venn-labeled-items/r/ggplot2/plot-dark.png +preview_html_light: null +preview_html_dark: null +quality_score: 86 +review: + strengths: + - 'Correct Imprint palette with first circle #009E73 (brand green), second #C475FD + (lavender), third #4467A3 (blue)' + - Semi-transparent circle fills (alpha=0.13) let overlapping regions show through + each other + - Bold serif font for category labels adds editorial magazine aesthetic matching + the spec intent + - All 7 interior zones populated with realistic 2025 tech items; item distribution + tells a coherent cultural story + - 'Perfect spec compliance: symmetric equilateral Venn, category names outside circles, + theme_void gridless background' + - Clean dplyr-based zone-positioning pipeline using group_by spread is elegant and + readable + - coord_fixed() used correctly to ensure circles stay circular + - 'Both themes correctly implemented: warm off-white #FAF8F1 light / near-black + #1A1A17 dark; data colors identical across themes' + weaknesses: + - 'Title uses INK_MUTED (#6B6A63 / #A8A79F) instead of the style-guide-specified + INK (#1A1A17 / #F0EFE8) for primary text; the title reads slightly grey against + the cream background' + - No visual hierarchy between individual item labels — all identical size and weight; + a subtle bold on center-zone items (ABC) or size variation would elevate the storytelling + - 'LM-02: ggplot2 is used correctly but the chart is essentially manual geometry + (geom_polygon circles + annotate labels) with few features unique to ggplot2 versus + other plotting libraries' + image_description: |- + Light render (plot-light.png): + Background: Warm off-white (#FAF8F1) — correct theme surface, not pure white + Chrome: Title "Tech Trends 2025 · venn-labeled-items · r · ggplot2 · anyplot.ai" rendered in INK_MUTED (#6B6A63, center-aligned, 12pt) — readable though slightly lighter than the style-guide primary-text recommendation. Category labels ("Buzzworthy", "Actually Useful", "Everyone Uses It") in bold serif, colored to match their respective circles. No axis labels (Venn does not require them). No tick labels. + Data: Three semi-transparent circles (alpha=0.13) in #009E73 (green, top/Buzzworthy), #C475FD (lavender, bottom-left/Actually Useful), #4467A3 (blue, bottom-right/Everyone Uses It). Circle outlines at linewidth=1.1 in matching colors. Item labels in dark INK (#1A1A17) distributed across all 7 zones (A, B, C, AB, AC, BC, ABC). 19 labeled tech items visible and readable. + Legibility verdict: PASS — all text is clearly visible against the warm off-white background; no light-on-light failures detected. Item labels in overlap zones (ABC, AB, AC) are closely spaced but non-overlapping and readable. + + Dark render (plot-dark.png): + Background: Warm near-black (#1A1A17) — correct dark surface, not pure black + Chrome: Title in INK_MUTED (#A8A79F) — readable against dark background. Category labels retain their Imprint palette colors (#009E73, #C475FD, #4467A3) which all read clearly on the dark surface. No dark-on-dark failures. + Data: Circle fills, outlines, and item text labels are all clearly distinguishable on the dark background. Item labels use INK (#F0EFE8, near-white) which provides strong contrast against #1A1A17. Data colors (#009E73, #C475FD, #4467A3) are identical to the light render. + Legibility verdict: PASS — all text clearly visible against the near-black background. Brand green #009E73 reads well on both surfaces. No dark-on-dark issues detected. + criteria_checklist: + visual_quality: + score: 29 + max: 30 + items: + - id: VQ-01 + name: Text Legibility + score: 7 + max: 8 + passed: true + comment: 'All font sizes explicitly set (title=12pt, category labels=4mm, + item labels=3.2mm). Readable in both themes. Minor deduction: title uses + INK_MUTED instead of INK for primary text.' + - id: VQ-02 + name: No Overlap + score: 6 + max: 6 + passed: true + comment: Zone-spread algorithm successfully distributes labels vertically + within each zone. No visible text collisions in any zone including tight + ABC and BC regions. + - id: VQ-03 + name: Element Visibility + score: 6 + max: 6 + passed: true + comment: Circle fills (alpha=0.13) and outlines (linewidth=1.1) are well-balanced. + All overlapping regions visible. Item labels sized appropriately for zone + density. + - id: VQ-04 + name: Color Accessibility + score: 2 + max: 2 + passed: true + comment: Imprint palette positions 1-3 are CVD-safe. Dark item text on cream + / light text on near-black provides strong contrast. No red-green sole-signal + issues. + - id: VQ-05 + name: Layout & Canvas + score: 4 + max: 4 + passed: true + comment: 2400x2400 square canvas used appropriately for symmetric Venn. Diagram + occupies ~65-70% of canvas area with balanced whitespace. No clipping at + edges. Category labels well within coord_fixed bounds. + - id: VQ-06 + name: Axis Labels & Title + score: 2 + max: 2 + passed: true + comment: No traditional axis labels needed for Venn diagram. Category labels + ('Buzzworthy', 'Actually Useful', 'Everyone Uses It') serve this function. + Title format 'Tech Trends 2025 · venn-labeled-items · r · ggplot2 · anyplot.ai' + is correct. + - id: VQ-07 + name: Palette Compliance + score: 2 + max: 2 + passed: true + comment: 'First circle = #009E73 (brand green). Positions 2-3 = #C475FD, #4467A3 + in canonical Imprint order. Background #FAF8F1 (light) / #1A1A17 (dark). + Data colors identical across themes. Chrome tokens INK, INK_SOFT, INK_MUTED + correctly theme-adaptive.' + design_excellence: + score: 11 + max: 20 + items: + - id: DE-01 + name: Aesthetic Sophistication + score: 4 + max: 8 + passed: false + comment: 'Well-configured above defaults: bold serif fonts for category labels + adds editorial character; semi-transparent fills are deliberate. But no + typography hierarchy within item labels, no visual emphasis on any particular + zone or item. Feels like a polished default rather than a designed artifact.' + - id: DE-02 + name: Visual Refinement + score: 4 + max: 6 + passed: false + comment: theme_void() is the right choice and explicitly applied. alpha=0.13 + for fills is well-calibrated. Generous whitespace. Serif font for category + labels is a nice detail. Not every detail polished — item labels are plain, + no subtle size/weight variation. + - id: DE-03 + name: Data Storytelling + score: 3 + max: 6 + passed: false + comment: Tech Trends 2025 categorization tells an opinionated story (Metaverse/Web3 + in Buzzworthy-only, ChatGPT/iPhone in ABC). The colored category labels + guide the eye. However, no visual hierarchy between item labels — all same + size and weight, requiring the reader to explore rather than being guided + to key insights. + spec_compliance: + score: 15 + max: 15 + items: + - id: SC-01 + name: Plot Type + score: 5 + max: 5 + passed: true + comment: Three-circle Venn diagram with labeled items in each zone — exactly + the spec's Chartgeist-style Venn. + - id: SC-02 + name: Required Features + score: 4 + max: 4 + passed: true + comment: 'All features present: symmetric equilateral layout, semi-transparent + fills, item labels inside zones, category names outside circles, gridless + background, all 7 interior zones populated, 19 items (within 10-25 range).' + - id: SC-03 + name: Data Mapping + score: 3 + max: 3 + passed: true + comment: Items correctly placed in designated zones via anchor + vertical + spread algorithm. Zone membership verified visually. + - id: SC-04 + name: Title & Legend + score: 3 + max: 3 + passed: true + comment: Title format 'Tech Trends 2025 · venn-labeled-items · r · ggplot2 + · anyplot.ai' — correct. No legend needed for this plot type. + data_quality: + score: 15 + max: 15 + items: + - id: DQ-01 + name: Feature Coverage + score: 6 + max: 6 + passed: true + comment: All 7 interior zones populated. Items span diverse set-membership + levels from pure-A to triple-ABC, demonstrating the full range of Venn diagram + semantics. + - id: DQ-02 + name: Realistic Context + score: 5 + max: 5 + passed: true + comment: 2025 tech trends with recognizable products (ChatGPT, iPhone, Notion, + etc.) in a neutral cultural commentary framing. Categorizations are opinionated + but plausible and non-controversial. + - id: DQ-03 + name: Appropriate Scale + score: 4 + max: 4 + passed: true + comment: 'Zone assignments are logically consistent: Metaverse/Web3 in Buzzworthy-only + reflects hype without utility; iPhone in ABC (all three) reflects its ubiquity; + Markdown in Actually-Useful-only reflects niche developer appreciation.' + code_quality: + score: 10 + max: 10 + items: + - id: CQ-01 + name: KISS Structure + score: 3 + max: 3 + passed: true + comment: 'Linear structure: imports → theme tokens → geometry → data → plot + → save. No functions or classes.' + - id: CQ-02 + name: Reproducibility + score: 2 + max: 2 + passed: true + comment: set.seed(42) at top. Data is hardcoded deterministically. + - id: CQ-03 + name: Clean Imports + score: 2 + max: 2 + passed: true + comment: ggplot2, dplyr, ragg — all used. No unused imports. + - id: CQ-04 + name: Code Elegance + score: 2 + max: 2 + passed: true + comment: Clean, appropriate complexity. dplyr pipeline for zone positioning + is elegant. Circle geometry computation is clear. No over-engineering. + - id: CQ-05 + name: Output & API + score: 1 + max: 1 + passed: true + comment: Saves as plot-{THEME}.png via sprintf. Uses ragg::agg_png. Modern + ggplot2 API (linewidth not size for line geoms). + library_mastery: + score: 6 + max: 10 + items: + - id: LM-01 + name: Idiomatic Usage + score: 4 + max: 5 + passed: true + comment: coord_fixed() for equal aspect ratio (crucial for circles), geom_polygon+geom_path + fill/outline pattern, theme_void() for diagram-appropriate styling, dplyr + group_by pipeline for positioning. Idiomatic throughout. + - id: LM-02 + name: Distinctive Features + score: 2 + max: 5 + passed: false + comment: Uses ggplot2 primitives (coord_fixed, geom_polygon, geom_path, annotate) + creatively, but the chart is fundamentally manual geometry that could be + replicated in other libraries. Limited use of features truly distinctive + to ggplot2's grammar. + verdict: APPROVED +impl_tags: + dependencies: [] + techniques: + - annotations + - layer-composition + patterns: + - data-generation + - groupby-aggregation + dataprep: [] + styling: + - minimal-chrome + - alpha-blending