Public
Edited
Sep 16, 2024
Insert cell
Insert cell
Insert cell
Insert cell
cars = FileAttachment("data.csv").csv()
Insert cell
cars
select * from cars order by 10
Insert cell
cars.columns
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.circle(cars.filter(C=>C["Year"]>2000), {y: "Make", x: "Year", fill:"#aabfab", sort: {y: "x", reverse: true}}),
Plot.ruleX([0], {fill:"#aaaaaa"})],
color: { legend: true },
marginLeft: 100,
})
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.barY(cars, Plot.groupX({y: "count"}, {x:"Driven_Wheels", fill:"#aabfab", sort: {y: "x", reverse: true}}),
Plot.ruleX([0], {fill:"#aaaaaa"}))],
color: { legend: true },
marginLeft: 100,
})
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.barX(cars, Plot.groupY({x: "count"}, {y:"Vehicle Style", fill:"#aabfab", sort: {y: "x", reverse: true}}),
Plot.ruleX([0], {fill:"#aaaaaa"}))],
color: { legend: true },
marginLeft: 150,
})
Insert cell
cars
DROP TABLE cars_year_average;
Insert cell
cars
CREATE TABLE IF NOT EXISTS cars_year_average AS
SELECT cars.Year, AVG(CAST(cars.MSRP AS DECIMAL))*70 AS average
FROM cars
WHERE cars."Market Category" == 'Crossover'
GROUP BY cars.Year;

Insert cell
cars
SELECT * FROM cars_year_average

Insert cell
cars
SELECT * FROM cars_year_average order by 2 desc
Insert cell
data1
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Select a data source…
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
viewof table_car = Inputs.table(data1)
Insert cell
data1
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(data1, {y: "Year", x: "average"})
]
})
Insert cell
Insert cell
Select a data source…
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
marks: [
Plot.circle(cars.filter(d=>d['Market Category']=='Crossover'), {x: "Year", y: "MSRP", fill: "Make"})
],
color: { legend: true },
marginLeft: 150,
})
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