This is the data frame i am working with:
Month HSI GSI K
Dec-12 1.703 0.516 0.315
Jan-13 1.841 0.441 0.316
Feb-13 NA NA NA
Mar-13 NA NA NA
Apr-13 NA NA NA
May-13 3.365 0.627 0.324
Jun-13 NA NA NA
Jul-13 NA NA NA
Aug-13 4.097 0.456 0.317
Sep-13 NA NA NA
Oct-13 2.582 0.977 0.336
Nov-13 3.728 1.178 0.352
Dec-13 2.211 3.937 0.352
Jan-14 1.617 1.163 0.336
I am trying to plot HSI, GSI and K on the same graph. I have no problem with that. However, my problem is that my curves are discontinuous due to the NA
fields, and i am only getting the year on the x axis.
This is what u an using:
library(zoo) #to plot multiple lines in the graph
library(timeDate) #to create a time series by month
tS = timeSequence(from = "2012-12-01", to = "2014-01-01", by = "month")
plot(tS,HSI, type="l",ann="False",ylim=c(1,5), pch=22, lty=1,lwd=2, col="red")
lines(tS,GSI,type="l",pch=22,lty=1,lwd=2, col="green") #to add other lines
lines(tS,K, type="l",pch=22,lty=1,lwd=2, col="blue")
Any help please? Thank you