Public
Edited
Feb 18, 2023
Insert cell
Insert cell
{
const chart = d3.create('div').call(pitch)
return chart.node()
}
Insert cell
pitch = d3_soccer.pitch()
.height(300) // Heigth of the SVG object (in pixels)
.rotate(false) // Rotate the pitch by 90 degrees
.showDirOfPlay(false) // Show an arrow on the plot to indicate the direction of play
.shadeMiddleThird(false) // Shade the middle third of the pitch
.pitchStrokeWidth(.5) // Strokewidth of the pitch lines
.goals("line") // Style used to draw the goals. Alternatives are "box" or a custom function.
.clip([[0, 0], [105, 68]]); // Clip the plotted area of the pitch
Insert cell
d3 = require("d3@5")
Insert cell
d3_soccer = require("d3-soccer@0.1.0")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more