Skip to main content
100%

ggplot2-Style Axis

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Dec 20, 2012

This example demonstrates ggplot2-style axes for a chart, combining gray grid lines with black ticks and labels. Two separate `d3.svg.axis` instances render the grid and the axis ticks, while a data-join’s exit selection customizes minor tick appearance. The grid lines use a tick size that spans the full chart height, and the background is a gray rectangle. The axes are drawn in SVG using D3 v3, with styling controlled through CSS classes.

AI-generated description

These axes are styled in the manner of ggplot2, a plotting system for R. Two d3.svg.axis instances are used: one for the gray grid lines, and one for the black ticks and labels below the bottom of the chart area. The exit selection of a data-join is used to customize the appearance of minor ticks.

gpl-3.0 Licensed

Similar vizzes