Platform
Resources
Pricing
Sign in
Get started
Eric Field
Building and Using Tools to See. UVA Architecture + Data Science. IT Director. Instructor.
Workspace
Fork
Public
the Basics
By
Eric Field
Edited
Mar 21, 2023
2 forks
Insert cell
Insert cell
<
svg
width
=
"1000"
height
=
"300"
>
<
rect
x
=
"20"
y
=
"20"
width
=
"250"
height
=
"150"
>
</
rect
>
</
svg
>
Insert cell
Insert cell
Insert cell
Insert cell
<
svg
width
=
"1000"
height
=
"300"
>
<
rect
x
=
"20"
y
=
"20"
width
=
${width}
height
=
"150"
>
</
rect
>
</
svg
>
Insert cell
width
=
250
Insert cell
Insert cell
Insert cell
<
svg
width
=
"1000"
height
=
"300"
>
<
rect
x
=
"20"
y
=
"20"
width
=
${width_slider}
height
=
"150"
>
</
rect
>
</
svg
>
Insert cell
viewof
width_slider
=
Inputs
.
range
(
[
0
,
500
]
,
{
label
:
"Width"
,
step
:
1
}
)
Insert cell
Insert cell
Insert cell
<
svg
width
=
"1000"
height
=
"300"
>
<
rect
x
=
"20"
y
=
"20"
width
=
"250"
height
=
"150"
>
</
rect
>
</
svg
>
Insert cell
myRectangle
=
d3
.
select
(
mySVG4
)
.
select
(
"rect"
)
Insert cell
myRectangle
.
attr
(
"width"
,
350
)
Insert cell
Insert cell
Insert cell
<
svg
width
=
"1000"
height
=
"300"
>
<
rect
x
=
"20"
y
=
"20"
width
=
"250"
height
=
"150"
>
</
rect
>
<
circle
cx
=
"50"
cy
=
"50"
r
=
"10"
style
=
"fill: yellow"
>
</
circle
>
</
svg
>
Insert cell
myCircle
=
d3
.
select
(
mySVG5
)
.
select
(
"circle"
)
Insert cell
myCircle
.
attr
(
"r"
,
50
)
Insert cell
Insert cell
myCircle
.
style
(
"fill"
,
"red"
)
Insert cell
Insert cell
Insert cell
<
svg
width
=
"1000"
height
=
"300"
>
<
rect
x
=
"20"
y
=
"20"
width
=
"250"
height
=
"150"
>
</
rect
>
<
circle
cx
=
"50"
cy
=
"50"
r
=
"10"
style
=
"fill: yellow"
>
</
circle
>
</
svg
>
Insert cell
myRectangle2
=
d3
.
select
(
mySVG6
)
.
select
(
"rect"
)
Insert cell
myRectangle2
.
attr
(
"x"
,
500
)
Insert cell
myRectangle2
.
attr
(
"x"
,
50
)
Insert cell
Insert cell
Insert cell
Insert cell
myRectangle3
=
d3
.
select
(
mySVG7
)
.
select
(
"rect"
)
Insert cell
myRectangle3
.
transition
(
)
.
duration
(
1000
)
.
attr
(
"x"
,
500
)
Insert cell
myRectangle3
.
transition
(
)
.
duration
(
1000
)
.
attr
(
"x"
,
50
)
Insert cell
myRectangle3
.
transition
(
)
.
ease
(
d3
.
easeLinear
)
.
duration
(
1000
)
.
attr
(
"x"
,
500
)
Insert cell
myRectangle3
.
transition
(
)
.
ease
(
d3
.
easeBounce
)
.
duration
(
1000
)
.
attr
(
"x"
,
50
)
Insert cell
Insert cell
Insert cell
Insert cell
myCircle2
=
d3
.
select
(
mySVG8
)
.
select
(
"circle"
)
Insert cell
myCircle2
.
transition
(
)
.
duration
(
1000
)
.
attr
(
"cx"
,
500
)
.
attr
(
"r"
,
150
)
.
style
(
"fill"
,
"red"
)
Insert cell
myCircle2
.
transition
(
)
.
duration
(
1000
)
.
attr
(
"cx"
,
50
)
.
attr
(
"r"
,
20
)
.
style
(
"fill"
,
"yellow"
)
Insert cell
Insert cell
Insert cell
<
svg
width
=
"1000"
height
=
"300"
>
<
rect
x
=
"20"
y
=
"20"
width
=
"250"
height
=
"150"
>
</
rect
>
<
circle
cx
=
"50"
cy
=
"50"
r
=
"10"
style
=
"fill: yellow"
>
</
circle
>
<
line
x1
=
"500"
x2
=
"600"
y1
=
"150"
y2
=
"150"
style
=
"stroke: blue; stroke-width: 2px"
>
</
line
>
</
svg
>
Insert cell
myLine
=
d3
.
select
(
mySVG9
)
.
select
(
"line"
)
Insert cell
myLine
.
attr
(
"transform"
,
"rotate(30 500,150)"
)
Insert cell
Insert cell
Insert cell
tick
=
ticker
(
10
)
Insert cell
myLine
.
attr
(
"transform"
,
"rotate("
+
tick
+
" 500,150)"
)
Insert cell
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
mySVG1
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mySVG2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
width
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
mySVG3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
width_slider
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
mySVG4
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
myRectangle
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
mySVG5
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
myCircle
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mySVG6
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
myRectangle2
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mySVG7
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
myRectangle3
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
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mySVG8
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
myCircle2
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mySVG9
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
myLine
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
tick
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
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML