1111# ' gsNew <- points(gs, y=1, x=2, xlim=c(0,NA),ylim=c(0,NA),
1212# ' col="blue", pch=18, legend.name="Points")
1313# ' gsNew <- lines(gsNew, c(3,4,3), c(2,4,6), legend.name="Lines")
14- # ' gsNew <- grid(gsNew, legend.name="Grid" )
14+ # ' gsNew <- grid(gsNew)
1515# ' gsNew <- abline(gsNew, b=1, a=0, legend.name="1:1")
1616# ' gsNew <- legend(gsNew, location="topleft",title="Awesome!")
1717# ' gsNew
3434# ' points(x=seq.Date(as.Date("2000-01-01"),as.Date("2010-01-01"),length.out = 20),
3535# ' y=1:20,axes=FALSE) %>%
3636# ' grid()
37- # 'gs
37+ # ' gs
38+ # '
39+ # ' gs <- gsplot() %>%
40+ # ' points(x=1:10, y=1:10) %>%
41+ # ' grid(lty=3, col="gray") %>%
42+ # ' axis(side=2, reverse=TRUE)
43+ # ' gs
3844grid <- function (object , ... ) {
3945 override(" graphics" , " grid" , object , ... )
4046}
@@ -68,7 +74,7 @@ draw_custom_grid <- function(object, index){
6874 if (view.info $ x.side.defined.by.user ){
6975 axes.index <- i [definded.sides == view.info $ x ]
7076 x <- object [axes.index ][[' axis' ]][[' arguments' ]][[' at' ]]
71- if (length( x.at ) != 0 ){
77+ if (! is.null( x ) ){
7278 x.at <- x
7379 }
7480 }
@@ -84,7 +90,7 @@ draw_custom_grid <- function(object, index){
8490 if (view.info $ y.side.defined.by.user ){
8591 axes.index <- i [definded.sides == view.info $ y ]
8692 y <- object [axes.index ][[' axis' ]][[' arguments' ]][[' at' ]]
87- if (length( y.at ) != 0 ){
93+ if (! is.null( y ) ){
8894 y.at <- y
8995 }
9096 }
0 commit comments