Recently Published
Change the colors
sales_by_years_cat_2_tbl <- bike_orderlines_wrangled_tbl %>% select(order_date, total_price, category_2) %>%
mutate(year= year(order_date)) %>%
group_by(year,category_2) %>% summarise(sales = sum(total_price)) %>% ungroup() %>% mutate(sale_text = scales::dollar(sales))
sales_by_years_cat_2_tbl %>% ggplot() + aes(x=year, y= sales, fill= category_2) + geom_col() + scale_y_continuous(labels = scales::dollar) +
facet_wrap(~category_2, scales="free_y") + geom_smooth(method= "lm", se =FALSE) + theme_tq() +
scale_fill_tq() + labs(title = "Revenue by Year and Category 2",
x= "",
y= "Revenue",
fill= "Product Secondary Category")
Facet_wrap() with trend line
sales_by_years_cat_2_tbl %>% ggplot() + aes(x=year, y= sales, fill= category_2) + geom_col() + scale_y_continuous(labels = scales::dollar) +
facet_wrap(~category_2, scales="free_y") + geom_smooth(method= "lm", se =FALSE)
Facet_wrap()
sales_by_years_cat_2_tbl %>% ggplot() + aes(x=year, y= sales, fill= category_2) + geom_col() + scale_y_continuous(labels = scales::dollar) +
facet_wrap(~category_2, scales="free_y")
Finnair 2019
lastYear <- subset(finnair_stock,date >"2018-12-31"& date < "2020-01-01")
Finnair 2020 (timetk + tidyquant)
thisYear %>% plot_seasonal_diagnostics(date,adjusted,.interactive = TRUE,.feature_set=c("week","year","month.lbl","wday.lbl"),.geom = c("boxplot", "violin"),.title="Finnair 2020")
thisYear <- subset(finnair_stock,date > "2019-12-31")
finnair_stock <- tq_get("FIA1S.HE",get = "stock.prices")
Plot
ggplot(mpg,aes(displ,hwy,color=class)) + geom_smooth(method=lm,se = FALSE) + geom_point()
Plot
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
geom_smooth(method = lm, se = FALSE)
Practise
ggplot(data=mpg,mapping = aes(x=displ, y= hwy, color=drv)) + geom_point() +geom_smooth(date=mpg,mapping = aes(linetype=drv,color=drv),se=FALSE)
Mutiple geom with only subcompact cars in smooth
ggplot(data=mpg,mapping= aes(x =displ,y=hwy))+ geom_point(mapping=aes(color=class)) +geom_smooth(data=filter(mpg,class=="subcompact"),se=FALSE)
Mutiple geom
ggplot(data=mpg,mapping= aes(x =displ,y=hwy,color=drv))+ geom_point() +geom_smooth()
Only take into account wheel type
ggplot(data=mpg) + geom_point(mapping=aes(x=displ, y=hwy,color=class)) + facet_grid(drv ~ .)
Combine by fuel type and wheel type
ggplot(data=mpg) + geom_point(mapping=aes(x=displ, y=hwy,color=class)) + facet_grid(drv ~ fl)
add more dimensions by combining two variables
ggplot basic
ggplot(data=mpg) + geom_point(mapping=aes(x=displ, y=hwy,color=class))
ggplot with facet_wrap by ca manufacturer
ggplot(data=mpg) + geom_point(mapping=aes(x=displ, y=hwy,color=class)) +facet_wrap(~ manufacturer,nrow=10)