I am struggling to get the date format right. The data is already in the melt() format. There are four variables in the data which happened to share the same data. I just like to plot a simple line chart with four lines(each variable as an indidividual line) and to display Sep-12 as the latest data point? I am using the older ggplot. Feel free to I have two questions.
First question: How to display the data quarterly (the date intervals are Sep-11, Dec-11, Mar-12, Jun-12 and Sep-12)?
Second question: How to suppress the grid lines and the grey background?
x4.1.m<-structure(list(Var.1=structure(c(1L,2L,3L,4L,5L,6L,1L,2L,3L,4L,5L,6L,1L,2L,3L,4L,5L,6L,1L,2L,3L,4L,5L,6L,1L,2L,3L,4L,5L,6L),.Label=c("I'vechangedforwork/anewjob/goneonaworkplan","Iwantaphonethat2degreesdoesn'toffer","IwantBestMates/Favourites","Iwasofferedorsawabetterofferonanothernetwork","Issueswiththe2degreesnetwork(poorcoverage)","Other"),class="factor"),YearQuarter=structure(c(1L,1L,1L,1L,1L,1L,2L,2L,2L,2L,2L,2L,3L,3L,3L,3L,3L,3L,4L,4L,4L,4L,4L,4L,5L,5L,5L,5L,5L,5L),.Label=c("2011-09-01","2011-12-01","2012-03-01","2012-06-01","2012-09-01"),class="factor"),value=c(0.23,0.23,0.121,0.25,0.223,0.14,0.39,0.22,0.05,0.37,0.25,0.2,0.09,0.14,0.05,0.3,0.4,0.12,0.13,0.1,0.26,0.38,0.28,0.15,0.33,0.05,0.06,0.44,0.32,0.43)),.Names=c("Var.1","YearQuarter","value"),row.names=c(NA,-30L),class="data.frame")
x4.1.m$YearQuarter <- format(as.Date(x4.1.m$YearQuarter),"%b-%y")
x4.line <- ggplot(data=x4.1.m, aes(x=factor(YearQuarter), y=value,colour=Var.1)) +
geom_smooth(se=F, size=1.5)+labs(y="Percentage",x="Year Quarter")
x4.line+geom_text(aes(label =paste(round(value*100,0), "%", sep=""),group=Var.1),
size = 3, hjust = 0.5, vjust =1.5) +
opts(axis.line = theme_segment(colour = "black"),
panel.grid.major = theme_blank(),
panel.background=theme_blank(),
panel.grid.minor = theme_blank(),
panel.border = theme_blank()) +
scale_y_continuous("Percentage",labels=percent, limits=c(0,0.5)) +
ggtitle("Percentages:Main Reasons for Leaving 2degrees by Quarter") +
theme(plot.title = element_text(size=rel(1.2)))