USGS-R / gsplot

plotting foundation for timeseries reporting
Other
6 stars 14 forks source link

draw_axis handling different data types #396

Closed lindsayplatt closed 8 years ago

lindsayplatt commented 8 years ago

fixing #395

sharing some helper functions with draw_custom_grid, but not quite to the extent #343 is talking about

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.1%) to 78.131% when pulling dfa2c0bcb9b064dfc0c530f1c40759e4d1c4290a on lindsaycarr:master into 40dbb30768912a3339f50d5218f837201cd6ff64 on USGS-R:master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.1%) to 78.131% when pulling dfa2c0bcb9b064dfc0c530f1c40759e4d1c4290a on lindsaycarr:master into 40dbb30768912a3339f50d5218f837201cd6ff64 on USGS-R:master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.1%) to 78.15% when pulling ca6f68ffe9be6a664342d21821bd6e99007f63f6 on lindsaycarr:master into 40dbb30768912a3339f50d5218f837201cd6ff64 on USGS-R:master.

lindsayplatt commented 8 years ago

using pretty() and everything does match base!

lindsayplatt commented 8 years ago

Base and gsplot are matching now

Base

some_dates <- seq(as.POSIXct("2010-10-01"), as.POSIXct("2011-09-30"), by="month")
plot(some_dates, 1:12)

image

gsplot

gs <- gsplot() %>% 
  points(some_dates, 1:12)
gs

image

lindsayplatt commented 8 years ago

Another example:

Base

library(dataRetrieval)
siteNumber <- '04085427'
startDate <- '2012-01-01'
endDate <- '2012-06-30'
pCode <- '00060'
dv <- readNWISdv(siteNumber,pCode, startDate, endDate)

plot(dv$Date, dv$X_00060_00003)

image

gsplot

gsplot() %>%
  points(dv$Date, dv$X_00060_00003)

image

lindsayplatt commented 8 years ago

Test for this is in the README

see Compatibility with base plotting section

date_vector <- seq(as.Date("2010-10-01"), as.Date("2011-09-30"), by="months")
gs <- gsplot() %>% 
  points(date_vector, 1:12)
gs

points(as.Date("2010-11-15"),2.5)

What the plot would look like before this PR: image

After this PR: image

coveralls commented 8 years ago

Coverage Status

Coverage increased (+1.4%) to 79.451% when pulling 23f522c4ac0d71eb2938c532edcdac5ef4d3e5e7 on lindsaycarr:master into 40dbb30768912a3339f50d5218f837201cd6ff64 on USGS-R:master.