Hello @zeeshan0112 ,
there is no need to list the whole dataset. A few lines make the structure clear.
An answer to your question could be
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(ggplot2)
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
set.seed(2021)
df = unique(data.frame(
stringsAsFactors = F,
bank = sample(c("ALD", "BOI", "BOM", "ZXG") , 100 , replace = TRUE),
year = sample(1991:2000, 100, replace = TRUE)
)) %>%
mutate(z_score = runif(nrow(.), 0, 1),
year = parse_date_time(as.character(year),"%y"))
ggplot(df, aes(x=year, y=z_score,color=bank)) +
geom_point(size=5, alpha=0.9) +
geom_hline(yintercept = 0,size=1.0,linetype=5)+
ggtitle("z-score for banks from 1991 to 2000")+
xlab("year") +
ylab("z score")
Created on 2021-07-24 by the reprex package (v2.0.0)
It produces the following plot:
