USGS-R / gsplot

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

Should grid get minor tick locations? #438

Open ldecicco-USGS opened 7 years ago

ldecicco-USGS commented 7 years ago

I think so. It's not obvious to me how.

gsplot(frame.plot=FALSE) %>%
    background_color(col="grey90") %>%
    grid(col = "white", lty = 1) %>%
    par(tcl=-0.2, cex=0.75, xaxs= "r", yaxs =  "r") %>%
    axis(side = c(1,2), lwd = 0, lwd.ticks = 1, n.minor=1)

@jiwalker-usgs maybe I can pick your brain to see if we can use some lazy_eval to get those locations.

lindsayplatt commented 7 years ago

it's not a base feature:

plot(1:10)
axis( 2, seq(1, 10, by=0.25), las = 1, tcl = .2, labels=FALSE )
grid(lwd = 2)
jiwalker-usgs commented 7 years ago

One of the issues with base is that a lot of information is lost in the approach it takes to plotting. For example grid has very little information of the previous calls that have taken place as can be seen above. The information it does have is only that which can be represented in par. The question we have then is how much do we want to go beyond base because we can, or how much we want to stay consistent with the way things work in base.

Probably worth a discussion.

ldecicco-USGS commented 7 years ago

Yeah, base grid is nearly useless...gsplot's is a lot better already. My vote is to have axis and grid act pretty similar:

gsplot() %>%
  axis(side = c(1,2), lwd = 0, lwd.ticks = 1, n.minor=1) %>%
  grid(n.minor=1)
ldecicco-USGS commented 7 years ago

That lets the user decide if they want the grid lines only at the major ticks, or both.