<>

Write scatterplot to get a scatterplot

by Breck Yunits

June 24, 2024 โ€” I engineered on many innovative data science tools, including Grapher and Ohayo[1].

So I was excited to see Observable launch something new: Plot.

*

Plot is already great on its own. It handles many of the hard parts of data vis, and it's open source, so we can help them fix the parts that are still a little rough.

But I found a way to take Plot to the next level: I combined it with Scroll.

The Plot/Scroll integration is early, but I can already tell it will evolve into a very useful data science tool.

*

A Scatterplot with 2 words

You can now make scatterplots with 2 words.

Obviously you want to add a few more words, but I don't think I'm exaggerating when I say that this is the simplest way to generate a scatterplot now and forever will be (until the day when we have mind-reading machines that can generate a scatterplot with zero words).

But enough talk, let's see some code. A tutorial is below.

To follow along, create a new website in 1 second using ScrollHub or install Scroll locally with npm install -g scroll-cli.

*

Step 1: Generate a scatterplot with 2 words

planets.csv scatterplot
*

Step 2: Add a title

planets.csv scatterplot title The Planets
*

Step 3: Add inline data

table scatterplot title The Simpson Family x age y height label name data name age height Homer 39 183 Bart 10 137 Lisa 8 120
*

Step 4: Everything everywhere all at once

planets.csv scatterplot title The Planets in our Solar System subtitle Note: This chart is not designed to be pretty but to show all the current features in the Scroll/Plot integration. caption Data from Wikipedia. x yearsToOrbitSun y moons fill diameter radius diameter label id symbol hasLife
*

That's it (for now)!

If you like where this is headed, give us a star on GitHub.

โ‚

[1] The difference between programming and engineering? It takes programming to make a program that works. It takes engineering to make a program that barely works.