[R] Dense time series

DJ L rhelp10 at gmail.com
Sun Dec 6 22:18:18 CET 2015


Hello R users!

Any idea why this looks so dense? Should be line graphs. Looks fine in
excel.  The csv file is four columns, first date, second well number, 3
well location (ditch or interior), and then the last column is hydraulic
head. Thank you!  I have attached a photo and the R code I am using.

setwd("c:/users/dot/desktop/r")

TS<-read.csv("TS_EAV1_SANDY.csv", header=TRUE,
sep=",",stringsAsFactors=FALSE)

# CHECK

head(TS)

str(TS)

#FORMAT DATE AND TIME

TS$Date <- as.POSIXct(TS$Date, tz = "", origin = "2012/10/22 0:00")

# CHECK
str(TS)

library(ggplot2)
library(scales)

#PLOT

xytheme <- theme(panel.background = element_blank(),
                 panel.grid.major.y = element_line(colour = "grey"),
                 panel.grid.minor.y = element_blank(),
                 panel.grid.major.x = element_line(colour = "grey"),
                 panel.grid.minor.x = element_blank(),
                 panel.border = element_rect(color = "black", fill = NA),
                 axis.text = element_text(color = "black", size = rel(1)),
                legend.title = element_blank())

###THIS ONE WORKS###

ggplot(TS, aes(Date, HYDRAULIC_HEAD.cm., group = Well)) +
  facet_grid(LOCATION~.) +
  geom_line(size=1) + xytheme +
  labs(x = "EAV1",y = "Water Levels, cm")+
scale_x_datetime(breaks = date_breaks("2 days"), labels =
date_format("%m/%d/%y"))


More information about the R-help mailing list