Platform
Resources
Pricing
Sign in
Get started
ee2dev
Workspace
Fork
Public
Plot
By
ee2dev
Edited
Jul 10, 2023
Fork of
Distributions and summary statistics - a collection of Plot examples
•
2 forks
9 stars
Insert cell
Insert cell
toc
(
)
Insert cell
Insert cell
Plot
.
plot
(
{
marginLeft
:
70
,
x
:
{
line
:
true
}
,
y
:
{
line
:
true
}
,
marks
:
[
Plot
.
barY
(
countries
,
Plot
.
groupX
(
{
y
:
"max"
}
,
{
y
:
"fert_rate"
,
x
:
"region"
}
)
)
]
}
)
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.
Insert cell
Plot
.
plot
(
{
marginLeft
:
70
,
x
:
{
line
:
true
,
domain
:
[
"Oceania"
,
"Africa"
,
"Americas"
,
"Asia"
,
"Europe"
]
// setting the order manually by specifying the array
}
,
y
:
{
line
:
true
}
,
marks
:
[
Plot
.
barY
(
countries
,
Plot
.
groupX
(
{
y
:
"max"
}
,
{
y
:
"fert_rate"
,
x
:
"region"
}
)
)
]
}
)
Insert cell
newOrder
=
d3
.
groupSort
(
countries
,
(
g
)
=>
d3
.
median
(
g
,
(
d
)
=>
d
.
fert_rate
)
,
(
d
)
=>
d
.
region
)
Insert cell
Plot
.
plot
(
{
marginLeft
:
70
,
x
:
{
line
:
true
,
domain
:
newOrder
// setting the order with d3.groupSort()
}
,
y
:
{
line
:
true
}
,
marks
:
[
Plot
.
barY
(
countries
,
Plot
.
groupX
(
{
y
:
"max"
}
,
{
y
:
"fert_rate"
,
x
:
"region"
}
)
)
]
}
)
Insert cell
Insert cell
Plot
.
plot
(
{
marginLeft
:
70
,
x
:
{
line
:
true
,
}
,
y
:
{
line
:
true
}
,
marks
:
[
Plot
.
barY
(
countries
,
Plot
.
groupX
(
{
y
:
"max"
}
,
{
y
:
"fert_rate"
,
x
:
"region"
,
sort
:
{
x
:
"y"
}
}
)
)
]
}
)
Insert cell
Plot
.
plot
(
{
marginLeft
:
70
,
x
:
{
line
:
true
,
}
,
y
:
{
line
:
true
}
,
marks
:
[
Plot
.
barY
(
countries
,
Plot
.
groupX
(
{
y
:
"max"
}
,
{
y
:
"fert_rate"
,
x
:
"region"
,
sort
:
{
x
:
"y"
,
reverse
:
true
}
}
)
)
]
}
)
Insert cell
Plot
.
plot
(
{
marginLeft
:
70
,
x
:
{
line
:
true
,
}
,
y
:
{
line
:
true
}
,
marks
:
[
Plot
.
barY
(
countries
,
Plot
.
groupX
(
{
y
:
"max"
}
,
{
y
:
"fert_rate"
,
x
:
"region"
,
sort
:
{
x
:
"y"
,
reverse
:
true
,
limit
:
3
}
}
)
)
]
}
)
Insert cell
2
Plot
.
plot
(
{
marginLeft
:
130
,
height
:
2000
,
x
:
{
line
:
true
}
,
y
:
{
line
:
true
}
,
color
:
{
legend
:
true
}
,
marks
:
[
Plot
.
barX
(
countries
,
Plot
.
groupY
(
{
x
:
"max"
}
,
{
x
:
"fert_rate"
,
y
:
"country"
,
fill
:
"region"
,
sort
:
{
y
:
"x"
,
reverse
:
true
}
}
)
)
]
}
)
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.
Insert cell
Plot
.
plot
(
{
width
:
100
,
marks
:
[
Plot
.
dot
(
countries
,
{
x
:
"area"
,
y
:
"region"
,
fill
:
"region"
,
r
:
"area"
}
)
]
}
)
Insert cell
Plot
.
plot
(
{
width
:
100
,
marks
:
[
Plot
.
dot
(
countries
,
{
x
:
"area"
,
y
:
"region"
,
fill
:
"region"
,
r
:
"area"
,
sort
:
"area"
}
)
]
}
)
Insert cell
{
const
plot1
=
Plot
.
plot
(
{
width
:
100
,
marks
:
[
Plot
.
dot
(
countries
,
{
x
:
"area"
,
y
:
"region"
,
fill
:
"region"
,
r
:
"area"
}
)
]
}
)
;
const
plot2
=
Plot
.
plot
(
{
width
:
100
,
marks
:
[
Plot
.
dot
(
countries
,
{
x
:
"area"
,
y
:
"region"
,
fill
:
"region"
,
r
:
"area"
,
sort
:
"area"
}
)
]
}
)
;
const
plot3
=
Plot
.
plot
(
{
width
:
100
,
marks
:
[
Plot
.
dot
(
countries
,
{
x
:
"area"
,
y
:
"region"
,
fill
:
"region"
,
r
:
"area"
,
sort
:
"area"
,
reverse
:
true
}
)
]
}
)
;
return
html
`${
plot1
}${
plot2
}${
plot3
}`
;
}
Insert cell
Insert cell
Insert cell
{
let
options
=
{
x
:
"date"
,
y
:
"middle"
,
k
:
28
}
;
if
(
shuffle_sort
)
options
=
Plot
.
sort
(
"date"
,
options
)
;
return
Plot
.
lineY
(
shuffled
,
Plot
.
windowY
(
options
)
)
.
plot
(
{
height
:
250
}
)
;
}
Insert cell
Plot
.
plot
(
{
marks
:
[
Plot
.
lineY
(
shuffled
,
Plot
.
windowY
(
Plot
.
sort
(
"date"
,
{
x
:
"date"
,
y
:
"middle"
,
k
:
28
}
)
)
)
]
}
)
Insert cell
Insert cell
import
{
countries
}
from
'@ee2dev/plot-party'
Insert cell
import
{
shuffled
}
from
'@observablehq/plot-window'
Insert cell
Insert cell
import
{
toc
}
from
"@mbostock/toc"
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
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
newOrder
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Show 2 comments
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
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
shuffle_sort
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
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
Add comment
Copy import
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
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML