md`Add data value (percent) on the top of each bar.`
Plot.plot({
caption:md`### Figure 1: Frequency of letters in English text.`,
inset:10,
y:{
nice:true,
grid:true
},
height:300,
style:{
background:"black",
color:"white"
},
marks:[
Plot.frame({
stroke:"black",
strokeOpacity:0.25,
fill:"red",
fillOpacity:0.5
}),
Plot.ruleY([0]),
Plot.barY(alphabets,{
x:"letter",
y:"frequency",
rx:2,
title:"Example"
}),
Plot.text(alphabets,{
x:"letter",
y:"frequency",
text:(d)=>(d.frequency*100).toFixed(1)+"%",
dy:-5
})
]
})
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.