R/mirror_gg.R

Defines functions facet_render.ggTicksAll facet_render.ggTicks mirror_ticks

Documented in facet_render.ggTicks facet_render.ggTicksAll mirror_ticks

# Add tick-mirroring to a ggplot object.
# (Actually just subclass it so that the mirroring will happen at render time.)
mirror_ticks = function(ggobj, allPanels=FALSE){
	tcl = if(allPanels==TRUE){ "ggTicksAll" }else{ "ggTicks" }
	class(ggobj$facet) = c(tcl, class(ggobj$facet))
	ggobj
}


# S3 methods to be picked up by the ggplot2::facet_render generic
facet_render.ggTicks = function(...){
	mirror_gtable(NextMethod("facet_render"))
}

facet_render.ggTicksAll = function(...){
	mirror_gtable(NextMethod("facet_render"), allPanels=TRUE)
}
infotroph/ggplotTicks documentation built on May 17, 2017, 4:16 a.m.