Skip to content

Commit f2a93f0

Browse files
Fix Scala.JS example in README (alexarchambault#237)
Co-authored-by: Alexandre Archambault <[email protected]>
1 parent 847ebda commit f2a93f0

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,20 @@ import plotly._, element._, layout._, Plotly._
6868

6969
Then define plots like
7070
```scala
71-
val x = 0.0 to 10.0 by 0.1
71+
val x = (0 to 100).map(_ * 0.1)
7272
val y1 = x.map(d => 2.0 * d + util.Random.nextGaussian())
7373
val y2 = x.map(math.exp)
7474

7575
val plot = Seq(
76-
Scatter(
77-
x, y1, name = "Approx twice"
78-
),
79-
Scatter(
80-
x, y2, name = "Exp"
81-
)
76+
Scatter(x, y1).withName("Approx twice"),
77+
Scatter(x, y2).withName("Exp")
8278
)
8379
```
8480
and plot them with
81+
8582
```scala
86-
plot.plot(
87-
title = "Curves"
88-
)
83+
val lay = Layout().withTitle("Curves")
84+
plot.plot("plot", lay) // attaches to div element with id 'plot'
8985
```
9086

9187

0 commit comments

Comments
 (0)