Skip to main content
100%

Pentagon

✓ Published3🌍 Public
CCurran Kelleher
Last edited Oct 1, 2018
Created on Sep 6, 2018
Forked from Face in d3

This example shows a pentagon constructed from five evenly spaced points around a central hub, with thick black lines radiating outward to each vertex and connecting adjacent vertices to form the polygon’s perimeter. The code uses d3’s `select` and `range` to compute the point coordinates via trigonometric functions, then generates line elements using D3’s data join. The visualization is rendered as an SVG with a fixed 960×800 canvas, and all styling is applied through attribute setters such as `attr('stroke-width', 15)`.

AI-generated description

Inspired by a figure from chapter 5 of Tamara Munzner's excellent book "Visualization Analysis and Design". Imported from Bl.ocks.org: Pentagon.

MIT Licensed

Similar vizzes