Published
Edited
Feb 27, 2022
1 star
Insert cell
# Prototype Plot for Practice Data Set
Insert cell
Insert cell
colors = ['blue', 'green', 'yellow', 'orange', 'red'].reverse()
Insert cell
data = _data.sort( (a,b) => a.v - b.v)
.map(i => ({word:i.w, accuracy:i.v, colorIndex: Math.ceil(i.v*colors.length) % colors.length, fill: colors[Math.ceil(i.v*colors.length) % colors.length]}));
Insert cell
Plot.plot( {
style:{background:'white', color: 'black', fontSize: '14px'},
insetLeft:20,

y: {
labelOffset: -20,
},
marks: [ Plot.barX(data, {x: 'accuracy', y: 'word', fill: 'accuracy', sort: {y: "x", reverse: true}})],
color: {
type:'linear', scheme:'spectral'
}
});
Insert cell
Insert cell
Insert cell
Insert cell
html`${plots}`
Insert cell
Insert cell
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