this is my second time asking question here. I hope I do it in a right way! I am plotting three subset of my data with ggplot and I am not putting any command for x-axis like every two years or something. My subsets data set are same size(they are 10 years long) but it gives me for two of them on x-axis every 5 years and for one every two years. how can I have same x-axis?
here is my code:
before2000<- wml%>%
filter(between(YYYYMM, 193001, 193912))
before2000$YYYYMM<- parse_date(as.character( before2000$YYYYMM), "%Y%m")
before2000$WML<-cumprod( before2000$WML+1)
before2000$WMLScaled<-cumprod( before2000$MOM_BS+1)
before2000<-before2000%>%
pivot_longer(cols=c(WML,WMLScaled),
names_to = "key", values_to = "values")
ggplot(data =before2000, aes(x= YYYYMM, y=values, color= key ))+
geom_line()+
labs(title = "Panel A: Riskmanaged momentum: 1930:01 to 1939:12",
y="Cumlative Return", x="")+
theme_classic()
after2000<- wml%>%
filter(between(YYYYMM, 200001, 201012))
after2000$YYYYMM<- parse_date(as.character( after2000$YYYYMM), "%Y%m")
after2000$WML<-cumprod( after2000$WML+1)
after2000$WMLScaled<-cumprod( after2000$MOM_BS+1)
after2000<-after2000%>%
pivot_longer(cols=c(WML,WMLScaled),
names_to = "key", values_to = "values")
ggplot(data =after2000, aes(x= YYYYMM, y=values, color= key))+
geom_line()+
labs(title = "Panel B: Riskmanaged momentum: 2000:01 to 2010:12",
y="Cumlative Return", x="")+
theme_classic()
after2010<- wml%>%
filter(between(YYYYMM, 201101, 202012))
after2010$YYYYMM<- parse_date(as.character( after2010$YYYYMM), "%Y%m")
after2010$WML<-cumprod( after2010$WML+1)
after2010$WMLScaled<-cumprod( after2010$MOM_BS+1)
after2010<-after2010%>%
pivot_longer(cols=c(WML,WMLScaled),
names_to = "key", values_to = "values")
ggplot(data =after2010, aes(x= YYYYMM, y=values, color= key ))+
geom_line()+
labs(title = "Panel C: Riskmanaged momentum: 2011:01 to 2020:12",
y="Cumlative Return", x="")+
theme_classic()