USGS-R / gsplot

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

minor ticks aren't inheriting pars #437

Closed ldecicco-USGS closed 7 years ago

ldecicco-USGS commented 7 years ago
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)

Should have the minor tick marks going outside, shows up inside:

image

ldecicco-USGS commented 7 years ago

Also:

gs <- gsplot() %>%
  points(1:100, 1:100, log="xy") %>%
  axis(side=c(3,4), labels=FALSE, n.minor=4) %>%
  axis(side=c(1,2), n.minor=4)
gs

side's 3 and 4 ticks aren't logged (and should be).

lindsayplatt commented 7 years ago

:point_up: @ldecicco-USGS I'm assuming this is example is something to do with #436 ?

ldecicco-USGS commented 7 years ago

They might be related, but that issue is specific to the date_axis.

ldecicco-USGS commented 7 years ago

Actually, that second example I posted has nothing to do with minor ticks. This:

gsplot() %>%
   points(1:100, 1:100, log="xy") %>%
   axis(side=c(3,4)) 

Shows a linear axis on 3 and 4 (and log on 1, 2). I would expect 3 and 4 to be logged if no other call to 3 & 4 are defined.

lindsayplatt commented 7 years ago

Yeah, that second example seems like a second issue.

ldecicco-USGS commented 7 years ago

Yup, making a new issue.

lindsayplatt commented 7 years ago

I'm seeing logged ticks now, but still seeing minor ticks on the inside instead of outside:

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)

image

gs <- gsplot() %>%
    points(1:100, 1:100, log="xy") %>%
    axis(side=c(3,4), n.minor=4) %>%
    axis(side=c(1,2), n.minor=4)
gs

image

lindsayplatt commented 7 years ago

436 seems to duplicate the remaining bug here. @ldecicco-USGS @jiwalker-usgs please verify this.

lindsayplatt commented 7 years ago

Wait, I did this earlier in this thread.... @ldecicco-USGS concluded that they were not the same. Sorry.

lindsayplatt commented 7 years ago

@ldecicco-USGS we have an arg called tcl.minor. That fixes the issue, but @jiwalker-usgs is thinking we should have the default match the tcl and tcl.minor needs to be used if you want them to be different. Either way, we need more documentation about this.

gsplot() %>%
    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, tcl.minor=-0.2)

image

lindsayplatt commented 7 years ago

Default tcl.minor = par('tcl')*0.5 so that it gets the correct direction. Add documentation about tcl.minor.

jordansread commented 7 years ago

Thought this would be relatively simple. issues I see here: 1) tcl gets ignored in axis already, which is 👎

points(gsplot(), 1, 0, tcl = -0.5) %>% axis(side=1)
#differs from 
points(gsplot(), 1, 0) %>% axis(side=1, tcl = 0.5)

2) axis is a call for multiple sides, so getting a default from a side par would need to be side-specific 3) There is a hierarch of getting the default for tcl.minor that goes like this (I may be missing one?):

jordansread commented 7 years ago

closed with #460