Published
Edited
Mar 30, 2020
Insert cell
Insert cell
Insert cell
a_simple_array = [1, 1, 2, 3, 5, 8]
Insert cell
Insert cell
a_simple_matrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
Insert cell
Insert cell
an_object_array = [
{ type: 'cat', color: 'grey' },
{ type: 'dog', color: 'black' }
]
Insert cell
Insert cell
an_object_array[0]
Insert cell
Insert cell
an_object_array[0].type
Insert cell
Insert cell
d3 = require('d3')
Insert cell
Insert cell
raw = d3.csv(
"https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv",
d3.autoType
)
Insert cell
Insert cell
Insert cell
an_object_array.map(v => v.type)
Insert cell
Insert cell
raw.map(v => v.date)
Insert cell
Insert cell
Plotly = require('https://cdn.plot.ly/plotly-latest.min.js')
Insert cell
Insert cell
function plot(traces, layout) {
const div = DOM.element('div');
Plotly.newPlot(div, traces, layout);
return div;
}
Insert cell
Insert cell
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Insert cell
y = x
Insert cell
trace1 = {
return { x: x, y: y, mode: 'markers', type: 'scatter' };
}
Insert cell
plot([trace1])
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