Platform
Resources
Pricing
Sign in
Get started
nilsfischer
Workspace
Fork
Public
Worksheets: Plot - Nils Fischer
By
Nils
Edited
May 1, 2023
Importers
24
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
AAPL.csv
Filter
Columns
Sort
Slice
Save
Type Table, then Shift-Enter. Ctrl-space for more options.
Insert cell
Insert cell
data
Clear All
Swap X/Y
Customize
X
Date
Y
Close
Color
#ff5375
Size
—
Facet X
—
Facet Y
—
Mark
line
Type Chart, then Shift-Enter. Ctrl-space for more options.
Insert cell
Insert cell
data
Clear All
Swap X/Y
Customize
X
Date
Y
Close
Color
#ff5375
Size
—
Facet X
—
Facet Y
—
Mark
area
Type Chart, then Shift-Enter. Ctrl-space for more options.
Insert cell
Insert cell
Insert cell
Plot
.
auto
(
data
,
{
x
:
"Date"
,
y
:
"Close"
,
color
:
"#ff5375"
,
mark
:
"line"
}
)
.
plot
(
)
Insert cell
Insert cell
Insert cell
Plot
.
plot
(
{
marks
:
[
Plot
.
ruleY
(
[
0
]
)
,
Plot
.
lineY
(
data
,
{
x
:
"Date"
,
y
:
"Close"
}
)
]
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Plot
.
plot
(
{
x
:
{
grid
:
true
}
,
y
:
{
grid
:
true
}
,
marks
:
[
Plot
.
ruleY
(
[
0
]
)
,
Plot
.
lineY
(
data
,
{
x
:
"Date"
,
y
:
"Close"
,
stroke
:
"salmon"
}
)
]
}
)
Insert cell
Insert cell
Insert cell
Plot
.
plot
(
{
x
:
{
grid
:
true
}
,
y
:
{
grid
:
true
}
,
marks
:
[
Plot
.
ruleY
(
[
0
]
)
,
Plot
.
lineY
(
data
,
{
x
:
"Date"
,
y
:
"Close"
,
stroke
:
"salmon"
}
)
,
Plot
.
lineY
(
data
,
{
x
:
"Date"
,
y
:
(
d
)
=>
d
[
"Volume"
]
/
100_000_000
,
stroke
:
"dodgerblue"
}
)
]
}
)
Insert cell
Insert cell
Insert cell
Insert cell
// Uncomment to activate
// `Close` is standardized for you.
// You should do the `Volume` yourself
data_standardized
=
aq
.
from
(
data
)
.
derive
(
{
CloseStandardized
:
(
d
)
=>
(
d
.
Close
-
op
.
mean
(
d
.
Close
)
)
/
op
.
stdev
(
d
.
Close
)
||
0
}
)
.
derive
(
{
VolumeStandardized
:
(
d
)
=>
(
d
.
Volume
-
op
.
mean
(
d
.
Volume
)
)
/
op
.
stdev
(
d
.
Volume
)
||
0
}
)
.
objects
(
)
Insert cell
Insert cell
Inputs
.
table
(
data_standardized
)
Insert cell
Insert cell
Plot
.
plot
(
{
x
:
{
grid
:
true
}
,
y
:
{
grid
:
true
}
,
marks
:
[
Plot
.
lineY
(
data_standardized
,
{
x
:
"Date"
,
y
:
"CloseStandardized"
,
stroke
:
"salmon"
}
)
,
Plot
.
lineY
(
data_standardized
,
{
x
:
"Date"
,
y
:
"VolumeStandardized"
,
stroke
:
"dodgerblue"
}
)
]
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof
startYear_slider
=
Inputs
.
range
(
[
1985
,
2023
]
,
{
label
:
"Start Year"
,
step
:
1
}
)
Insert cell
Insert cell
startYear_slider
Insert cell
Insert cell
// To use copied code replace "data" with your own variable
aq
.
from
(
data_standardized
)
.
filter
(
(
d
)
=>
d
[
"Date"
]
>
1078145679826.4642
)
.
objects
(
)
// Uncomment to return an array of objects
Insert cell
Insert cell
Insert cell
data_standardized
[
0
]
.
Date
.
constructor
.
name
Insert cell
Insert cell
data_standardized
[
0
]
.
Date
.
getTime
(
)
Insert cell
Insert cell
Insert cell
Insert cell
startYear_slider_asTimeObject
=
new
Date
(
startYearFixed_slider
,
1
)
.
getTime
(
)
Insert cell
Insert cell
data_standerdized_filtered
=
aq
.
from
(
data_standardized
)
.
filter
(
aq
.
escape
(
(
d
)
=>
d
[
"Date"
]
>
startYear_slider_asTimeObject
)
)
.
objects
(
)
// Uncomment to return an array of objects
Insert cell
viewof
startYearFixed_slider
=
Inputs
.
range
(
[
1985
,
2023
]
,
{
label
:
"Start Year"
,
step
:
1
}
)
Insert cell
Insert cell
Plot
.
plot
(
{
x
:
{
grid
:
true
}
,
y
:
{
grid
:
true
}
,
marks
:
[
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"CloseStandardized"
,
stroke
:
"salmon"
}
)
,
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"VolumeStandardized"
,
stroke
:
"dodgerblue"
}
)
]
}
)
Insert cell
Insert cell
Plot
.
plot
(
{
x
:
{
grid
:
true
}
,
y
:
{
grid
:
true
}
,
marks
:
[
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"CloseStandardized"
,
stroke
:
"salmon"
}
)
,
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"VolumeStandardized"
,
stroke
:
"dodgerblue"
,
curve
:
"step"
}
)
]
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot
.
plot
(
{
color
:
{
legend
:
true
}
,
x
:
{
grid
:
true
}
,
y
:
{
grid
:
true
}
,
marks
:
[
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"CloseStandardized"
,
stroke
:
"salmon"
}
)
,
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"VolumeStandardized"
,
stroke
:
"dodgerblue"
,
curve
:
"step"
}
)
]
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot
.
plot
(
{
color
:
{
legend
:
true
}
,
x
:
{
grid
:
true
,
nice
:
true
}
,
y
:
{
grid
:
true
,
nice
:
true
,
label
:
"↑Z-Score"
}
,
marks
:
[
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"CloseStandardized"
,
stroke
:
"salmon"
}
)
,
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"VolumeStandardized"
,
stroke
:
"dodgerblue"
,
curve
:
"step"
}
)
]
}
)
Insert cell
Insert cell
Insert cell
Insert cell
// Uncomment to activate
import
{
Plot
}
from
"@mkfreeman/plot-tooltip"
Insert cell
Plot
.
plot
(
{
color
:
{
legend
:
true
}
,
x
:
{
grid
:
true
,
nice
:
true
}
,
y
:
{
grid
:
true
,
nice
:
true
,
label
:
"↑Z-Score"
}
,
marks
:
[
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"CloseStandardized"
,
stroke
:
"salmon"
,
title
:
"Close"
}
)
,
Plot
.
lineY
(
data_standerdized_filtered
,
{
x
:
"Date"
,
y
:
"VolumeStandardized"
,
stroke
:
"dodgerblue"
,
curve
:
"step"
,
title
:
"Volume"
}
)
]
}
)
Insert cell
Insert cell
Insert cell
Insert cell
// ... your code here
Insert cell
Insert cell
import
{
Wrangler
,
op
}
from
"@observablehq/data-wrangler"
Insert cell
Insert cell
import
{
toc
}
from
"@nebrius/indented-toc"
Insert cell
import
{
imageToDo
}
from
"@clokman/student-blocks"
Insert cell
imageToDo
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
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
File attachments
AAPL.csv
CSV
Databases
Filter
Column
Operator
Columns
Sort
Column
Direction
Descending
Ascending
Slice
From
Start
To
End
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
data
File attachments
AAPL.csv
CSV
Customize
Clear
Title
Subtitle
Caption
Height
Width
Auto
Full
Margin
Top
Right
Bottom
Left
Inset
Legend
Auto
None
X label
X scale
Auto
Scale
Auto
linear
log
sqrt
symlog
point
band
X options
Grid
Reverse
Y label
Y scale
Auto
Scale
Auto
linear
log
sqrt
symlog
point
band
Y options
Grid
Reverse
Color scheme
Auto
Color scheme
Auto
Default color schemes
Sequential
Diverging
Cyclical
Categorical
Sequential color schemes
Blues
Greens
Greys
Oranges
Purples
Reds
Turbo
Viridis
Inferno
Magma
Plasma
Cividis
Warm
Cool
BuGn
BuPu
GnBu
OrRd
PuBuGn
PuBu
PuRd
RdPu
YlGnBu
YlGn
YlOrBr
YlOrRd
Diverging color schemes
BrBG
PRGn
PiYG
PuOr
RdBu
RdGy
RdYlBu
RdYlGn
Spectral
Cyclical color schemes
Sinebow
Turbo
Categorical color schemes
Category10
Accent
Dark2
Paired
Pastel1
Pastel2
Set1
Set2
Set3
Tableau10
Color scale
Auto
Scale
Auto
linear
log
sqrt
symlog
categorical
ordinal
Color options
Reverse
Reducer
—
Auto
—
count
distinct
sum
min
max
mean
median
mode
Field
—
Reducer
—
Auto
—
count
distinct
sum
min
max
mean
median
mode
Field
—
Reducer
—
Auto
—
count
distinct
sum
min
max
mean
median
mode
Field
—
Reducer
—
Auto
—
count
distinct
sum
min
max
mean
median
mode
Field
—
Field
—
Field
—
Mark
Auto
bar
dot
line
area
rule
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
Cells
data
File attachments
AAPL.csv
CSV
Customize
Clear
Title
Subtitle
Caption
Height
Width
Auto
Full
Margin
Top
Right
Bottom
Left
Inset
Legend
Auto
None
X label
X scale
Auto
Scale
Auto
linear
log
sqrt
symlog
point
band
X options
Grid
Reverse
Y label
Y scale
Auto
Scale
Auto
linear
log
sqrt
symlog
point
band
Y options
Grid
Reverse
Color scheme
Auto
Color scheme
Auto
Default color schemes
Sequential
Diverging
Cyclical
Categorical
Sequential color schemes
Blues
Greens
Greys
Oranges
Purples
Reds
Turbo
Viridis
Inferno
Magma
Plasma
Cividis
Warm
Cool
BuGn
BuPu
GnBu
OrRd
PuBuGn
PuBu
PuRd
RdPu
YlGnBu
YlGn
YlOrBr
YlOrRd
Diverging color schemes
BrBG
PRGn
PiYG
PuOr
RdBu
RdGy
RdYlBu
RdYlGn
Spectral
Cyclical color schemes
Sinebow
Turbo
Categorical color schemes
Category10
Accent
Dark2
Paired
Pastel1
Pastel2
Set1
Set2
Set3
Tableau10
Color scale
Auto
Scale
Auto
linear
log
sqrt
symlog
categorical
ordinal
Color options
Reverse
Reducer
—
Auto
—
count
distinct
sum
min
max
mean
median
mode
Field
—
Reducer
—
Auto
—
count
distinct
sum
min
max
mean
median
mode
Field
—
Reducer
—
Auto
—
count
distinct
sum
min
max
mean
median
mode
Field
—
Reducer
—
Auto
—
count
distinct
sum
min
max
mean
median
mode
Field
—
Field
—
Field
—
Mark
Auto
bar
dot
line
area
rule
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
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
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
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data_standardized
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
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
cleanshot20230426At1834062x
Edit
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
cleanshot20230426At1835142x
Edit
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
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
startYear_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
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
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
startYear_slider_asTimeObject
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
data_standerdized_filtered
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
startYearFixed_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
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
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
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
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
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
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
cleanshot20230426At2106232x
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
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
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML