Public
Edited
Nov 23, 2022
1 star
Insert cell
Insert cell
Insert cell
// Automatic choice dependent on domain and width
chart1 = Plot.plot({
width: svg_width,
height: 200,
x: {
domain: [d3.utcParse("%Y")(2017), d3.utcParse("%Y")(2023)]
},
y: { domain: [-30, 30] },
marks: [Plot.ruleX([d3.utcParse("%Y")(2017)]), Plot.ruleY([0])]
})
Insert cell
// Specifying exactly where you'd like the ticks to be placed and a format
chart2 = Plot.plot({
height: 200,
x: {
domain: [d3.utcParse("%Y")(2017), d3.utcParse("%Y")(2023)],
ticks: d3.timeMonth.range(
d3.utcParse("%Y")("2017"),
d3.utcParse("%Y")("2024"),
6
),
tickFormat: d3.timeFormat("%b/%y")
},
y: { domain: [-30, 30] },
marks: [Plot.ruleX([d3.utcParse("%Y")(2017)]), Plot.ruleY([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