A convenience function to remove facet stripes from `ggplot2` plot.

rm_stripes(axis = "xy")

Arguments

axis

String indicating axis from which the stripes should be removed: either "x", "y", "xy". Default is "xy".

Value

Updated ggplot2 object of class ggplot.

Details

rm_stripes is a wrapper of function theme with one of the 3 options (depending on value of input variable "axis") strip.text.x, strip.text.y, or strip.text set to element_blank().

Author

Vilmantas Gegzna

Examples


p <- ggplot(Spectra2, wl.range = c(min ~ 420, 500~600)) +
     geom_line(aes(color = gr)) +
     facet_wl("class")
#> Warning: Function 'chk.hy' is deprecated. 
#> Use function 'assert_hyperSpec' instead.
#> Error in Re(from): non-numeric argument to function

p
#> function (x, wrap = panderOptions("p.wrap"), sep = panderOptions("p.sep"), 
#>     copula = panderOptions("p.copula"), limit = Inf, keep.trailing.zeros = panderOptions("keep.trailing.zeros"), 
#>     missing = panderOptions("missing"), digits = panderOptions("digits"), 
#>     round = panderOptions("round")) 
#> {
#>     attributes(x) <- NULL
#>     stopifnot(is.vector(x))
#>     stopifnot(all(sapply(list(wrap, sep, copula), function(x) is.character(x) && 
#>         length(x) == 1)))
#>     x.len <- length(x)
#>     if (x.len == 0) {
#>         return("")
#>     }
#>     stopifnot(x.len <= limit)
#>     w <- which(is.na(x))
#>     if (is.numeric(x)) {
#>         x <- round(x, digits = round)
#>         if (!keep.trailing.zeros) {
#>             x <- sapply(x, format, trim = TRUE, digits = digits, 
#>                 decimal.mark = panderOptions("decimal.mark"))
#>         }
#>         else {
#>             x <- format(x, trim = TRUE, digits = digits, decimal.mark = panderOptions("decimal.mark"))
#>         }
#>     }
#>     if (length(w) > 0) {
#>         x[w] <- missing
#>     }
#>     if (x.len == 1) {
#>         wrap(x, wrap)
#>     }
#>     else if (x.len == 2) {
#>         paste(wrap(x, wrap), collapse = copula)
#>     }
#>     else {
#>         paste0(paste(wrap(head(x, -1), wrap), collapse = sep), 
#>             copula, wrap(tail(x, 1), wrap))
#>     }
#> }
#> <bytecode: 0x0000022b08b62740>
#> <environment: namespace:pander>
p + rm_stripes("x")
#> NULL
p + rm_stripes()
#> NULL