Ejercicio Clase 3
# Preliminaries
# Import libraries
library(ggplot2)
library(GGally)
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
theme_set(theme_bw())
Boxplot
# Create custom color palette
colPalette <- c("#46237A","#3DDC97","#FF495C")
# Use of a default dataset IRIS (comes with R)
# First plot, descriptive statistics using scatter & boxplots
resumen <- ggplot(iris, aes(Sepal.Length, Sepal.Width))
resumen <- resumen + geom_boxplot(aes(group=Species, fill=Species, alpha=0.35))
resumen <- resumen + geom_point(aes(color=Species, alpha=0.5))
resumen <- resumen + facet_grid(.~Species)
resumen <- resumen + scale_fill_manual(values=colPalette)
resumen <- resumen + scale_color_manual(values=colPalette)
resumen <- resumen + theme(legend.position = "none" )
# show plot
resumen

Coordenadas paralelas
# Parallel coordinates
plot <- ggparcoord(iris,
columns=c(1:4),
showPoints=TRUE,
groupColumn = 'Species')
plot <- plot + scale_color_manual(values = colPalette)
plot

Facets
plot <-plot + facet_grid(Species~.)
plot
