Skip to main content
Public

Share visualization

Loading preview…

Margins

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

Margins

0
Mmelissastrong89@gmail.com
Last edited Mar 14, 2025
Created on Mar 14, 2025
Forked from Margins

This visualization demonstrates the concept of inner margins in a chart, showing a gray rectangle that represents the area reserved for data marks, surrounded by empty space for axes. The code uses D3’s `select` and `join` methods to create an SVG element sized to the container, then draws the inner rectangle with fixed 50-pixel margins on all sides. The example highlights how explicit margin calculations (using `innerWidth` and `innerHeight`) define the plotting region, using D3 version 7.8.5 to render the static shape.

AI-generated description

We define the "inner rectangle" for our visualizations using margins! These are important for

  • Defining where the marks go for our data visualizations
  • Giving space for the axes

Comments

Sign in to join the discussion.

MIT Licensed