#SCript de datos de millas por galones
#datos de 1999 y 2008 de combustible de la EPA
#Importar bibliotecas
library(datos)
## Warning: package 'datos' was built under R version 3.6.2
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.6.1
#puntos
ggplot(data=millas) +
geom_point(mapping = aes(x=motor,y=autopista))

#colores
ggplot(data=millas) +
geom_point(mapping = aes(x=motor,y=autopista, color=clase))

#tama昼㸱os
ggplot(data=millas) +
geom_point(mapping = aes(x=motor,y=autopista, size=clase))
## Warning: Using size for a discrete variable is not advised.

#figuras
#tama昼㸱os
ggplot(data=millas) +
geom_point(mapping = aes(x=motor,y=autopista, alpha=clase))
## Warning: Using alpha for a discrete variable is not advised.

#agrupar gr攼㸱fico en p攼㸱neles
ggplot(data=millas) +
geom_point(mapping = aes(x=motor,y=autopista)) +
facet_wrap(~ clase, nrow=2)

millas1 = millas
#grafica de sombreado
ggplot(data=millas) +
geom_smooth(mapping = aes(x=motor,y=autopista, linetype=traccion))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
