Tips for Ellipse Summary Plot
This article is originally published at https://tomizonor.wordpress.com
I privately had some questions and reply here, because it may also help others including me.
1. How to specify size
With plot axis parameters.
> ellipseplot(iris[,c(‘Species’, ‘Sepal.Length’)], iris[,c(‘Species’, ‘Sepal.Width’)], xlim=c(4,8), ylim=c(2,5))
2. How to specify color
With plot color parameter.
> ellipseplot(iris[,c(‘Species’, ‘Sepal.Length’)], iris[,c(‘Species’, ‘Sepal.Width’)], col=c(‘cyan’, ‘orange’, ‘magenta’))
3. How to give names
Using builtin iris
data.
> ellipseplot(iris[,c(‘Species’, ‘Sepal.Length’)], iris[,c(‘Species’, ‘Sepal.Width’)])
Digging deeper
about iris data
> str(iris)
‘data.frame’: 150 obs. of 5 variables:
$ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 …
$ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 …
$ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 …
$ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 …
$ Species : Factor w/ 3 levels “setosa”,”versicolor”,..: 1 1 1 1 1 1 1 1 1 1 …
The column Species
are used in both of x and y data. These are used to give the name of each catergory.
example
Using fivenum instead of default ninenum.
> ellipseplot(iris[,c(‘Species’, ‘Sepal.Length’)], iris[,c(‘Species’, ‘Sepal.Width’)], col=c(‘cyan’, ‘orange’, ‘magenta’), SUMMARY=fivenum)
Above shows the plot shown above.
Below may help you to know values on each axis. Here, for the fivenum
, each 3rd values is a (x, y) set of each category average.
> ellipseplot(iris[,c(‘Species’, ‘Sepal.Length’)], iris[,c(‘Species’, ‘Sepal.Width’)], SUMMARY=fivenum, plot=FALSE)
$setosa
x y
1 4.3 2.3
2 4.8 3.2
3 5.0 3.4
4 5.2 3.7
5 5.8 4.4$versicolor
x y
1 4.9 2.0
2 5.6 2.5
3 5.9 2.8
4 6.3 3.0
5 7.0 3.4$virginica
x y
1 4.9 2.2
2 6.2 2.8
3 6.5 3.0
4 6.9 3.2
5 7.9 3.8
Thanks for visiting r-craft.org
This article is originally published at https://tomizonor.wordpress.com
Please visit source website for post related comments.