Skip to content

Commit a7dc989

Browse files
authored
Merge pull request #45 from marius311/better_readme_example
update readme with better fitting interpolation
2 parents 6d3dc01 + 83928e4 commit a7dc989

File tree

2 files changed

+209
-8
lines changed

2 files changed

+209
-8
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,25 @@ function.
99

1010
## Synopsis
1111

12-
`Loess` exports two functions: `loess` and `predict`, that train and apply the model, respectively.
12+
`Loess` exports two functions, `loess` and `predict`, that train and apply the model, respectively. The amount of smoothing is mainly controlled by the `span` keyword argument. E.g.:
1313

1414

1515
```julia
16-
using Loess
16+
using Loess, Plots
1717

1818
xs = 10 .* rand(100)
1919
ys = sin.(xs) .+ 0.5 * rand(100)
2020

21-
model = loess(xs, ys)
21+
model = loess(xs, ys, span=0.5)
2222

2323
us = range(extrema(xs)...; step = 0.1)
2424
vs = predict(model, us)
2525

26-
using Gadfly
27-
p = plot(x=xs, y=ys, Geom.point, Guide.xlabel("x"), Guide.ylabel("y"),
28-
layer(Geom.line, x=us, y=vs))
29-
draw(SVG("loess.svg", 6inch, 3inch), p)
26+
scatter(xs, ys)
27+
plot!(us, vs, legend=false)
3028
```
3129

32-
![Example Plot](http://JuliaStats.github.io/Loess.jl/loess.svg)
30+
![Example Plot](loess.svg)
3331

3432
There's also a shortcut in Gadfly to draw these plots:
3533

0 commit comments

Comments
 (0)