Skip to main content
100%

Let's make a face with D3

✓ Published0🌍 Public
AAnuj Saboo
Last edited Oct 18, 2022
Created on Oct 18, 2022

This example uses D3 v5 to render a simple yellow smiley face in SVG, with black circular eyes and a mouth drawn as an arc. The code demonstrates core D3 selection and joining through `select`, chained `.attr()` methods for styling, and the `arc()` generator to create the mouth path. It sets up a group element (`g`) translated to the center of a 960×500 SVG canvas, positions elements with explicit pixel coordinates, and relies on `d3.min.js` from unpkg. The face is static, showing SVG primitives without data binding or interactivity.

AI-generated description

An example including some commonly used features of SVG.

MIT Licensed

Similar vizzes