7.3 Visualisation

library(ggplot2)
library(tidyr)

p1 = ggplot(data_lm2, aes(asx, bhp))
p1 + geom_point(colour = "brown") + geom_smooth(method = "lm") + theme_minimal() +
    labs(title = "Scatter plot of BHPvsASX and Linear Fit")

p2 = ggplot(data_lm2, aes(Date))
p2 + geom_line(aes(y = bhp, color = "bhp"), size = 1, lty = 1) + geom_line(aes(y = asx,
    color = "asx"), size = 1, lty = 2) + scale_color_discrete("Asset") +
    theme_minimal() + labs("Line Chart of Returns")