-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1103 from Mattriks/Geom_ellipse
Geom.ellipse
- Loading branch information
Showing
6 changed files
with
142 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ language: julia | |
os: | ||
- linux | ||
julia: | ||
- 0.5 | ||
- 0.6 | ||
- nightly | ||
notifications: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
```@meta | ||
Author = "Mattriks" | ||
``` | ||
|
||
# Geom.ellipse | ||
|
||
Confidence ellipse for a scatter or group of points, using a parametric multivariate distribution e.g. multivariate normal. `Geom.ellipse` is an instance of [`Geom.polygon`](@ref) | ||
|
||
## Aesthetics | ||
|
||
* `x`: Position of points. | ||
* `y`: Position of points. | ||
* `color` (optional): Color. | ||
* `group` (optional): Group. | ||
|
||
## Arguments | ||
|
||
* `distribution`: A multivariate distribution. Default is `MvNormal`. | ||
* `levels`: The quantiles for which confidence ellipses are calculated. Default is [0.95]. | ||
* `nsegments`: Number of segments to draw each ellipse. Default is 51. | ||
|
||
|
||
## Examples | ||
|
||
```@setup 1 | ||
using RDatasets, Gadfly | ||
Gadfly.set_default_plot_size(14cm, 8cm) | ||
``` | ||
|
||
```@example 1 | ||
D = dataset("datasets","faithful") | ||
D[:g] = D[:Eruptions].>3.0 | ||
coord = Coord.cartesian(ymin=35, ymax=100) | ||
pa = plot(D, coord, | ||
x=:Eruptions, y=:Waiting, group=:g, | ||
Geom.point, Geom.ellipse | ||
) | ||
pb = plot(D, coord, | ||
x=:Eruptions, y=:Waiting, color=:g, | ||
Geom.point, Geom.ellipse, | ||
layer(Geom.ellipse(levels=[0.99]), style(line_style=:dot)), | ||
style(key_position=:none), Guide.ylabel(nothing) | ||
) | ||
hstack(pa,pb) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Distributions, Gadfly | ||
set_default_plot_size(6.6inch, 3.3inch) | ||
|
||
srand(123) | ||
d = rand(MvNormal([2, 2],[1.0 0.7; 0.7 1.0]), 50)' | ||
|
||
pa= plot(x=d[:,1], y=d[:,2], Geom.point, layer(Stat.ellipse, Geom.polygon(preserve_order=true))) | ||
pb= plot(x=d[:,1], y=d[:,2], Geom.point, Geom.ellipse(levels=[0.95, 0.99])) | ||
hstack(pa,pb) |