See the README for one example where the lack of ticks is at least expected. A case where this might arise with less warning:
p = ggplot(mtcars, aes(wt, mpg)) + geom_point() + scale_x_log10()
p
# Huh, no ticks assigned to the x-axis.
# This is arguably a bug in somewhere in `scale`, but plot looks OK otherwise
mirror_ticks(p)
# Error in match_axes(cur_panel, axis_extents) : Can't match axes to panel
Possible fixes:
Explicitly check each scale for ticks, skip if empty.
Pro: Most robust, probably easy-ish.
Con: Inserts yet more code into the functions that depend heavily on ggplot internal structure.
Allow explicit control over which axes to mirror.
Pro: Could be a useful extension anyway -- maybe somebody wants ticks on right, left, bottom, but not top?
Con: Lots of work, commits to another API change.
Claim all axes need ticks, WONTFIX this, and file a bug against scale_x_log10.
Pro: Easy.
Con: the entire point of ggplotTicks is to be less opinionated than ggplot2 is.
See the README for one example where the lack of ticks is at least expected. A case where this might arise with less warning:
Possible fixes:
scale_x_log10
. Pro: Easy. Con: the entire point of ggplotTicks is to be less opinionated than ggplot2 is.