USGS-R / gsplot

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

grid is adding axis labels #430

Closed ldecicco-USGS closed 7 years ago

ldecicco-USGS commented 7 years ago
gs2 <- gsplot() %>% 
  points(c(1,10,100), 1:3, side=1) %>% 
  points(c(10,100,1000), 3:5, col="blue", side=3, log='x') %>% 
  axis(side=3) %>%
  grid() %>%
  grid(side=c(3,4), col="green")
gs2

image

I don't think that should have any ticks or labels on side 4.

ldecicco-USGS commented 7 years ago

I think it's because of: https://github.com/USGS-R/gsplot/blob/master/R/grid.R#L100

@jiwalker-usgs maybe in your current work, you are getting the pretty date tick locations somewhere else?

ldecicco-USGS commented 7 years ago

Actually, nevermind. I understand now. Anytime a side is defined, we that axis. For example:

gs <- gsplot() %>%
        points(x.date,1:10) %>%
        lines(6:14,6:14,side=c(3,4)) 

image

So then grid actually does follow the right pattern. If I didn't want the labels:

gs2 <- gsplot() %>% 
  points(c(1,10,100), 1:3, side=1) %>% 
  points(c(10,100,1000), 3:5, col="blue", side=3, log='x') %>% 
  axis(side=c(3,4), labels=FALSE) %>%
  grid() %>%
  grid(side=c(3,4), col="green")
gs2

image