scale_x_break | R Documentation |
Set an axis break point for a 'gg' plot
scale_x_break(
breaks,
scales = "fixed",
ticklabels = NULL,
expand = TRUE,
space = 0.1
)
scale_y_break(
breaks,
scales = "fixed",
ticklabels = NULL,
expand = TRUE,
space = 0.1
)
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 |
space |
the blank space among the subplots after break, default is 0.1 (cm). |
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.
gg object
Guangchuang Yu
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.