I have data in excel that I would love to plot in chronological order, Unfornately it does appear in order.
My code are here:
library(tidyverse)
library(lubridate)
library(ggplot2)
OTCData <- file.choose()
OTC<- read.csv(OTCData,header=TRUE)
ggplot(data=OTC, aes(x=OTC$DATE,y=OTC$NotionalAmounts))+
geom_line()+
geom_line(aes(x = DATE, y = NotionalAmounts),
color = "red",
alpha = 0.6,
size = 1,
group =1) +
labs(x="Date",y="Amount in US$")+
ggtitle("Notional Amount Outstanding For OTC Derivatives For All Category")+
theme(panel.background = element_rect(fill="white", colour="white", size=0.5,
linetype="solid", color="black"),
plot.title = element_text(hjust = 0.5),
panel.grid.minor = element_line(size = (0.2), colour="grey"),
panel.grid.major = element_line(colour ="grey",size = (0.1)),
axis.text.x=element_text(angle=60, hjust=1))
The code produce the graph below which is not plotted in chronological order of date
Please anyone to help out?