[R] Dense time series

William Dunlap wdunlap at tibco.com
Mon Dec 7 01:27:34 CET 2015


I cannot see either your data or your picture.  Does the following dataset
along with your ggplot command give a similar picture?

TS <- data.frame(Well=paste0("Well",rep(1:21,each=3)),
LOCATION=paste0("Loc",rep(LETTERS[1:7],each=9)),
Date=as.POSIXct(paste(sep="-", 2015, 10, rep(c(11,18,25),21))),
HYDRAULIC_HEAD.cm.=100*(log2(1:63)+sin(1:63)+1))

If so, then describe what you mean by 'dense'.  I prefer finer lines,
like those produced by geom_line(size=0), but I don't know if that
is what you mean by dense..

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Sun, Dec 6, 2015 at 1:18 PM, DJ L <rhelp10 at gmail.com> wrote:
> 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"))
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list