Platform
Resources
Pricing
Sign in
Get started
Observable
The end-to-end solution for building and hosting better data apps, dashboards, and reports.
Workspace
Fork
Public
By
Fil
Edited
Jun 8, 2023
2 forks
17 stars
Insert cell
Insert cell
2
Plot
.
plot
(
{
color
:
{
legend
:
true
,
type
:
"quantize"
,
scheme
:
"spectral"
,
n
:
10
,
label
:
"percentile"
}
,
y
:
{
label
:
"density"
}
,
marks
:
[
Plot
.
rectY
(
numbers
,
{
fill
:
(
d
,
i
)
=>
i
,
...
Plot
.
binX
(
{
y
:
(
bin
,
{
x1
,
x2
}
)
=>
1
/
(
x2
-
x1
)
,
thresholds
:
percentiles
}
)
}
)
,
Plot
.
ruleY
(
[
0
]
)
]
}
)
Insert cell
numbers
=
Float64Array
.
from
(
{
length
:
10000
}
,
d3
.
randomNormal
.
source
(
d3
.
randomLcg
(
3
)
)
(
)
)
Insert cell
function
percentiles
(
numbers
)
{
const
sorted
=
d3
.
sort
(
numbers
)
;
return
d3
.
range
(
0
,
101
)
.
map
(
(
q
)
=>
d3
.
quantileSorted
(
sorted
,
q
/
100
)
)
;
}
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
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Show 2 comments
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
numbers
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
percentiles
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML