Skip to content

Commit 32c7209

Browse files
committed
Integers. Probably need to think about other things.
1 parent 794c05e commit 32c7209

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

R/grid.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
#' grid(side=c(1,2),col="green") %>%
3030
#' grid(side=c(3,4))
3131
#' gs
32+
#'
33+
#' gs <- gsplot() %>%
34+
#' points(x=seq.Date(as.Date("2000-01-01"),as.Date("2010-01-01"),length.out = 20),
35+
#' y=1:20,axes=FALSE) %>%
36+
#' grid()
37+
#'gs
3238
grid <- function(object, ...) {
3339
override("graphics", "grid", object, ...)
3440
}
@@ -51,7 +57,7 @@ draw_custom_grid <- function(object, index){
5157

5258
grid.args <- set_args("grid",object[[index]][['grid']], package = "graphics")
5359

54-
if(class(window$xlim) == "numeric"){
60+
if(class(window$xlim) %in% c("numeric","integer")){
5561
x.at <- axTicks(view.info$x)
5662
} else if (class(window$xlim) == "Date"){
5763
x.at <- axis.Date(view.info$x,window$xlim)
@@ -67,7 +73,7 @@ draw_custom_grid <- function(object, index){
6773
}
6874
}
6975

70-
if(class(window$ylim) == "numeric"){
76+
if(class(window$ylim) %in% c("numeric","integer")){
7177
y.at <- axTicks(view.info$y)
7278
} else if (class(window$ylim) == "Date"){
7379
y.at <- axis.Date(view.info$y,window$ylim)

man/grid.Rd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,11 @@ gs <- gsplot() \%>\%
3737
grid(side=c(1,2),col="green") \%>\%
3838
grid(side=c(3,4))
3939
gs
40+
41+
gs <- gsplot() \%>\%
42+
points(x=seq.Date(as.Date("2000-01-01"),as.Date("2010-01-01"),length.out = 20),
43+
y=1:20,axes=FALSE) \%>\%
44+
grid()
45+
gs
4046
}
4147

0 commit comments

Comments
 (0)