Platform
Resources
Pricing
Sign in
Get started
Alex Kraieski
R and JavaScript developer. Open to collaborations!
Workspace
Fork
Public
By
Alex Kraieski
Edited
Apr 2, 2023
Fork of
Input + Chart
1
Insert cell
Insert cell
Insert cell
Insert cell
viewof
bins
=
Inputs
.
range
(
[
3
,
20
]
,
{
step
:
1
,
label
:
"Bins"
}
)
Insert cell
Plot
.
plot
(
{
marks
:
[
Plot
.
ruleY
(
[
0
]
)
,
Plot
.
rectY
(
data
,
Plot
.
binX
(
{
y
:
"count"
}
,
{
x
:
"Distance"
,
thresholds
:
bins
,
fill
:
"#ff2800"
}
)
)
// forza ferrari fill ha
]
}
)
Insert cell
Insert cell
Insert cell
Plot
.
plot
(
{
x
:
{
tickFormat
:
"d"
}
,
marks
:
[
//Plot.dot(data, {x: "Year", y: "Distance"}),
Plot
.
line
(
data
,
{
x
:
"Year"
,
y
:
"Distance"
,
title
:
(
d
)
=>
// tooltip, see imports at bottom
`${
d
.
Car
} #${
d
[
"Car #"
]
} \n Year: ${
d
.
Year
} \n Team: ${
d
.
Team
} \n Distance: ${
d
.
Distance
} mi.`
}
)
]
}
)
Insert cell
Insert cell
viewof
regression_start_year
=
Inputs
.
range
(
[
1966
,
2015
]
,
{
value
:
2004
,
step
:
1
,
label
:
"Starting year:"
}
)
Insert cell
regressionPlot
=
Plot
.
plot
(
{
x
:
{
tickFormat
:
"d"
}
,
y
:
{
label
:
"Distance (mi.)"
}
,
marks
:
[
//Plot.dot(data, {x: "Year", y: "Distance"}),
Plot
.
line
(
lmdata
,
{
x
:
"Year"
,
y
:
"Distance"
}
)
,
Plot
.
linearRegressionY
(
lmdata
,
{
x
:
"Year"
,
y
:
"Distance"
,
stroke
:
"steelblue"
,
ci
:
0.95
}
)
]
}
)
Insert cell
Insert cell
lmdata
=
data
.
filter
(
d
=>
d
.
Year
>=
regression_start_year
)
Insert cell
Insert cell
// Import Plot with additional tooltip functionality from this notebook
import
{
Plot
}
from
"@mkfreeman/plot-tooltip"
Insert cell
Insert cell
Insert cell
data
=
FileAttachment
(
"daytona_24_overall_winners.csv"
)
.
csv
(
{
typed
:
true
}
)
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.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
bins
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
regression_start_year
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
regressionPlot
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
lmdata
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML