scale_break: scale_x_break

Description Usage Arguments Details Value Author(s) Examples

View source: R/scales.R

Description

Set an axis break point for a 'gg' plot

Usage

1
2
3
scale_x_break(breaks, scales = "fixed", ticklabels = NULL, expand = TRUE)

scale_y_break(breaks, scales = "fixed", ticklabels = NULL, expand = TRUE)

Arguments

breaks

break point

scales

relative width or height of subplots, default is "fixed". If scale is 'free', all subplots have equal width or height. It also can be any number to set relative width or height compare to first subplot.

ticklabels

the axis labels to subplot, default is NULL.

expand

default is TRUE, logical or a vector of range expansion constants used to add some padding around the data to ensure that they are placed some distance away from the axes. Use the convenience function expansion() of ggplot2 to generate the values for the expand argument. The defaults are to expand the scale by 5% on each side for continuous variables. If it is logical, the TRUE means the default of ggplot2 (foregoing statement), and FALSE means no expand for the plot.

Details

This scale function set an axis break point for a 'gg' plot. Either 'x' and 'y' axes are supported. The result is still a 'gg' object and user can progressively add layers to it.

Value

gg object

Author(s)

Guangchuang Yu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
require(ggplot2 )
set.seed(2019-01-19)
d <- data.frame(
  x = 1:20,
  y = c(rnorm(5) + 4, rnorm(5) + 20, rnorm(5) + 5, rnorm(5) + 22)
)

p <- ggplot(d, aes(x, y)) + geom_col()
x <- p+scale_y_break(c(7, 17 ) )
print(x)

ggbreak documentation built on Oct. 25, 2021, 5:10 p.m.