The Original Graph:

  1. set work directory and read data file

  2. draw the original graph

dat$Date1 <- factor(dat$Date, levels=unique(dat$Date))


p <- ggplot(data = dat, mapping = aes(x = Date1, y = The_Average))
p + geom_bar(data = dat, mapping = aes(x = Date1, y = The_Average), 
             stat = 'identity', fill = "#0B0B61", width = 0.6) +
    theme(axis.text.x = element_text(size = 15, vjust = 0.5, angle = 90), 
          panel.background=element_rect(fill = "white"),
          panel.grid.major = element_line(color = "lightgrey"),
          axis.line = element_line(size=0.5, colour = 'black'),
          plot.title = element_text(hjust = 0.5))+
    scale_y_continuous(labels = dollar)+
    scale_x_time(labels = NULL)+
    labs(x="Date",y=" ",title = "Residential Average Price Great Vancouver")

# Here is a big problem That I cannot change the y axis value
# The x-label
  1. draw a modified graph: 1)change into a dot graph
p <- ggplot(data = dat, mapping = aes(x = Date1, y = The_Average))
p + geom_point(stat = 'identity', size=1,shape=21) +
    theme(axis.text.x = element_text(size = 15, vjust = 0.5, angle = 90), 
          panel.background=element_rect(fill = "white"),
          panel.grid.major = element_line(color = "lightgrey"),
          axis.line = element_line(size=0.5, colour = 'black'),
          plot.title = element_text(hjust = 0.5))+
    scale_y_continuous(labels = dollar)+
    scale_x_time(labels = NULL)+
    labs(x="Date",y=" ",title = "Residential Average Price Great Vancouver")+
    geom_hline(aes(yintercept= 743903.96)) 

  1. a personal changed version
  1. Use three dimensions: year(x), month(y), price(z)
  2. Considering the many kinds of residences, using a interactional graph.
library(rgl)
## Warning: package 'rgl' was built under R version 3.5.2
options(scipen = 999)
setwd("C:/Users/sirui/OneDrive/Course Material/EPSE 581/Mid term") 
dat2<-read.csv(file = 'GVREP2.csv')


plot_ly(x=dat2$Year, 
        y=dat2$Month, 
        z=dat2$Price, 
        type="scatter3d", 
        mode="markers", 
        color=dat2$Type, size = 4)
## Warning: package 'bindrcpp' was built under R version 3.5.2