Skip to main content
Public

Share visualization

Loading preview…

Lets make a face with D3.js!

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Lets make a face with D3.js!

0
Llerik03
Last edited Nov 28, 2022
Created on Nov 28, 2022

This example builds a simple cartoon face using D3.js v5 and SVG. It draws a yellow circle for the face, two black circles for eyes, and an arc-based path for the mouth, all positioned relative to the SVG’s width and height attributes. The code uses `d3.select`, `.append`, and method chaining with `.attr` to set geometry. The mouth is created with `d3.arc()`, specifying inner and outer radii and start/end angles, then applied to a `<path>` inside a translated `<g>` element.

AI-generated description

An example including some commonly used features of SVG.

Comments

Sign in to join the discussion.

MIT Licensed