[R] Minor tick marks for date/time ggplot2 (this is better, but not exactly what I want)

stephen sefick ssefick at gmail.com
Mon Jun 1 21:18:41 CEST 2009


library(ggplot2)

melt.updn <- (structure(list(date = structure(c(11808, 11869, 11961, 11992,
12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057,
13149, 11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418,
12600, 12631, 12753, 12996, 13057, 13149), class = "Date"), site =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("unrestored",
"restored"), class = "factor"), value = c(1.10799962473684, 0.732152347032395,
0.410438861475827, 0.458941230025228, 0.429883166858706, 0.831083728521569,
0.601942073736539, 0.81855597155132, 1.12612228239269, 0.246006569972335,
0.940239233910111, 0.98645360143702, 0.291191536260016, 0.346271105079473,
1.36216149279675, 0.878585508942967, 0.525184260519839, 0.803247305232454,
1.08086182748669, 1.24915815325761, 0.971046497346528, 0.936835411801682,
1.26957337598606, 0.337691543740682, 0.90931142298893, 0.950891472223867,
0.290354002109368, 0.426509990013021)), .Names = c("date", "site",
"value"), row.names = c(NA, -28L), class = "data.frame"))

#I would also like to add tick marks to this graph is possible with no
label for the months in between the years
qplot(date, value, data=melt.updn, shape=site, ylab="Distance"
,main="Euclidean Distances Time Series", xlim=c(as.Date("2002-1-1"),
as.Date("2006-3-1")))+geom_line()+theme_bw()+geom_vline(x=as.numeric(as.Date("2002-11-01")))
+ opts(panel.grid.major = theme_line(colour="grey", size=0.75),
panel.grid.minor=theme_line(colour="grey", size=0.25))

thanks
-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis




More information about the R-help mailing list