Platform
Resources
Pricing
Sign in
Get started
Gary McClelland
Professor Emeritus, University of Colorado Boulder
Workspace
Fork
Public
By
Gary McClelland
Edited
May 12, 2023
2 forks
Insert cell
Insert cell
Plot
.
plot
(
{
marks
:
[
Plot
.
ruleY
(
[
0
]
)
,
Plot
.
lineY
(
func
,
{
x
:
"x"
,
y
:
"y"
}
)
]
}
)
Insert cell
Insert cell
xmin
=
-
5
// specify minimum for x
Insert cell
xmax
=
5
// specify maximum for x
Insert cell
int
=
0.25
// specify interval for steps between xmin and xmax; adjust for smoothness
Insert cell
f
=
(
x
)
=>
1
+
x
+
0.5
*
x
*
x
// the function to be plotted. in this case a quadratic
Insert cell
func
=
{
let
dd
=
[
]
;
for
(
let
i
=
xmin
;
i
<=
xmax
;
i
=
i
+
int
)
dd
.
push
(
{
x
:
i
,
y
:
f
(
i
)
}
)
;
return
dd
}
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
xmin
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
xmax
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
int
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
f
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
func
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML