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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more