Unlisted
Edited
Jun 14, 2023
Insert cell
Insert cell
data = [
{a: 1, b: 1, c:1},
{a: 2, b: 1, c:2},
{a: 1, b: 2, c:1},
{a: 2, b: 2, c:2},
{a: 4, b: 1, c:1},
{a: 3, b: 1, c:2},
{a: 4, b: 2, c:1},
{a: 3, b: 2, c:2},
]
Insert cell
Insert cell
Plot.plot({
x: {
label: 'My X'
},
y: {
label: 'My Y'
},
symbol: {
label: 'My Symbol'
},
marks: [
Plot.dot(
data,
{x: 'a', y: 'b', symbol: 'c', tip: true},
),
],
})

Insert cell
Insert cell
Plot.plot({
x: {
label: 'My X'
},
y: {
label: 'My Y'
},
symbol: {
label: 'My Symbol'
},
marks: [
Plot.dot(
data,
{x: 'a', y: 'b', symbol: 'c'},
),
Plot.tip(
data,
Plot.pointer({x: 'a', y: 'b', symbol: 'c'}),
),
],
})

Insert cell
## `Plot.tip` mark with `channels`
Tooltips display channels `a`, `b`, and `c`, but don't apply the `label` for `symbol: 'c'`:
Insert cell
Plot.plot({
x: {
label: 'My X'
},
y: {
label: 'My Y'
},
symbol: {
label: 'My Symbol'
},
marks: [
Plot.dot(
data,
{x: 'a', y: 'b', symbol: 'c'},
),
Plot.tip(
data,
Plot.pointer({x: 'a', y: 'b', channels: {symbol: 'c'}}),
),
],
})
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