El paquete ggplot2 nos permite crear gráficos estadísticos de gran calidad.
colores_001 =c("orange","blue","purple")
ggplot(mtcars,aes(x=cyl)) + geom_bar(fill=colores_001,width=1) + geom_text(stat="count",aes(label=..count..),vjust=-0.5) +geom_line(aes(x=cyl,y=stat(count)),stat="count",group=1,size=1,color="darkblue") +labs(x="Cilindros",y="Frecuencias",title="Número de Cilindros",subtitle = "Var:Cyl")+
theme_dark()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: The dot-dot notation (`..count..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(count)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: `stat(count)` was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(count)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.