grafico de lineas
library(tidyverse)
library(data.table)
library(lubridate)
library(ggrepel)
library(scales)
library(hrbrthemes)
library(ggplot2)
data <- fread("superstore.csv")
aux1 <- data %>%
mutate(FecOrden = as.Date(FecOrden, "%d/%m/%Y"),
FecEnvio = as.Date(FecEnvio, "%d/%m/%Y"),
FechaOrden= floor_date(FecOrden, unit = "month")
) %>%
group_by(FechaOrden, Segmento, Categoria, Prioridad) %>%
summarise(TotVentas = sum(Venta))
ggplot(aux1) +
aes(x = FechaOrden, y = TotVentas, colour = Segmento) +
geom_line(size = 0.5) +
geom_smooth(size = 0.5,se = FALSE) +
scale_color_manual(values = c(Consumer = "#EC1506",
Corporate = "#4B67AE",
`Home Office` = "#037121")) + #facet_wrap(vars(Prioridad),vars(Categoria)) +
facet_grid(Categoria~Prioridad) +
hrbrthemes::theme_ft_rc() +
geom_label_repel(aes(label=TotVentas,colour=Segmento)) +
theme(panel.background = element_rect(colour = "black"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position="bottom")+
labs (x = "Fecha de la orden", y="Total de Ventas(en $)",
title = "Historico de Ventas")
grafico de lineas
ggplot(aux1) +
aes(x = FechaOrden, y = TotVentas, colour = Segmento) +
geom_line(size = 0.5) +
geom_smooth(size = 0.5,se = FALSE) +
scale_color_manual(values = c(Consumer = "#EC1506",
Corporate = "#4B67AE",
`Home Office` = "#037121")) +
#hrbrthemes::theme_ft_rc() +
facet_grid(cols=vars(Prioridad),rows=vars(Categoria)) +
geom_label_repel(aes(label=TotVentas,colour=Segmento)) +
theme(panel.background = element_rect(colour = "black",fill = "#303445"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position="bottom",
plot.background = element_rect(fill = "#303445"),
axis.text = element_text(color='#47C4D4')
)+
labs (x = "Fecha de la orden", y="Total de Ventas(en $)",
title = "Historico de Ventas")