-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draw_axis handling different data types #396
Conversation
@@ -88,14 +88,22 @@ axis.gsplot <- function(object, ..., n.minor=0, tcl.minor=0.15, reverse=NULL) { | |||
|
|||
} | |||
|
|||
draw_axis <- function(axis.args){ | |||
draw_axis <- function(object, side.args){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't side.args
redundant w/ object
? How about just object
and side
or side.name
?
fun.name <- 'axis' | ||
} else { | ||
fun.name <- paste0('axis.', class(side.lim)[1L]) | ||
axis.args$at <- get_axTicks(object, as.side(side.name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this line? What does it do? I think you want to let the function axis.class
figure out the at
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as.POSIXct and axis.Date don't allow at
to be NULL, so I had to define it and then pass it in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will just return Error in as.Date(x) : argument "x" is missing, with no default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, ok. thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like axis.args$at
doesn't handle
gs <- gsplot() %>%
points(some_dates, 1:12) %>%
axis(1)
gs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in what way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geez, sorry. I flipped branches too many times trying to track this down. It does handle that as expected.
I am completely confused why you can give axis
all those at
values and it still only renders the two extremes. This issue has me totally stumped.
using |
@@ -96,8 +96,7 @@ grid_axTicks <- function(object, side){ | |||
if(is.numeric(lim)){ | |||
at <- axTicks(side) | |||
} else{ | |||
fun <- getFromNamespace(paste0('axis.',class(lim)[1L]),'graphics') | |||
at <- fun(side, x = lim, lwd=0, lwd.ticks=0, labels = FALSE) | |||
at <- Axis(side = side, x = pretty(lim), lwd=0, lwd.ticks=0, labels = FALSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, so this is the key change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep - needed pretty()
so that it wasn't just passing two values. Then switched to using Axis
because that internally handles all of the axis.[class]
stuff
fixing #395
sharing some helper functions with
draw_custom_grid
, but not quite to the extent #343 is talking about