Public
Edited
May 4, 2023
14 forks
46 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
myCategoricalColors = ["orange", "#56B4e9", "#009e73", "tomato", "steelblue", "#f0e442"] // Edit these values, or add more!
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(cars, {
x: "power (hp)",
y: "economy (mpg)",
fill: "cylinders",
r: 5
})
],
color: { range: myCategoricalColors } // Your custom color scheme here
})
Insert cell
Insert cell
myContinuousColors = ["orange", "#9700ff"] // Edit these colors!
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(cars, {
x: "power (hp)",
y: "economy (mpg)",
fill: "economy (mpg)",
r: 5
})
],
color: {
range: myContinuousColors, // Your custom color scheme here
interpolate: "hcl"
}
})
Insert cell
Insert cell
Insert cell
Insert cell
<style>
@import url('https://fonts.googleapis.com/css2?family=Lato&display=swap');
</style>
Insert cell
Insert cell
Insert cell
myGoogleFonts
Insert cell
Insert cell
Plot.plot({
style: {fontFamily: "Lato"}, // Update with your imported Google font to change all in chart
y: {
grid: true,
label: "↑ Frequency (%)",
transform: (d) => d * 100
},
marks: [
Plot.barY(alphabet, { x: "letter", y: "frequency" }),
Plot.text(alphabet, {
x: "letter",
y: "frequency",
text: (d) => (d.frequency * 100).toFixed(1),
dy: -5
}),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
kalam = FileAttachment("Kalam-Regular.ttf")
Insert cell
Insert cell
<style>
@font-face {
font-family: Kalam;
src: url('${await kalam.url()}');
}
</style>
Insert cell
Insert cell
Insert cell
myDownloadedFonts
Insert cell
Insert cell
Plot.plot({
y: {
grid: true,
label: "↑ Frequency (%)",
transform: (d) => d * 100
},
marks: [
Plot.barY(alphabet, { x: "letter", y: "frequency" }),
Plot.text(alphabet, {
x: "letter",
y: "frequency",
text: (d) => (d.frequency * 100).toFixed(1),
dy: -5,
fontFamily: "Kalam",
fontSize: 14,
fill: "red",
dy: -10
}),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(cars, { x: "power (hp)", y: "economy (mpg)" }),
Plot.frame(),
Plot.image([logo], { src: [logo], frameAnchor: "top-right", dx: -80, width: 130 }) // Add, position and size your logo
],
})
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