EVOLUTION-MANAGER
Edit File: expansion.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Generate expansion vector for scales</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for expansion {ggplot2}"><tr><td>expansion {ggplot2}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Generate expansion vector for scales</h2> <h3>Description</h3> <p>This is a convenience function for generating scale expansion vectors for the <code>expand</code> argument of <a href="scale_continuous.html">scale_(x|y)_continuous</a> and <a href="scale_discrete.html">scale_(x|y)_discrete</a>. The expansion vectors are used to add some space between the data and the axes. </p> <h3>Usage</h3> <pre> expansion(mult = 0, add = 0) expand_scale(mult = 0, add = 0) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>mult</code></td> <td> <p>vector of multiplicative range expansion factors. If length 1, both the lower and upper limits of the scale are expanded outwards by <code>mult</code>. If length 2, the lower limit is expanded by <code>mult[1]</code> and the upper limit by <code>mult[2]</code>.</p> </td></tr> <tr valign="top"><td><code>add</code></td> <td> <p>vector of additive range expansion constants. If length 1, both the lower and upper limits of the scale are expanded outwards by <code>add</code> units. If length 2, the lower limit is expanded by <code>add[1]</code> and the upper limit by <code>add[2]</code>.</p> </td></tr> </table> <h3>Examples</h3> <pre> # No space below the bars but 10% above them ggplot(mtcars) + geom_bar(aes(x = factor(cyl))) + scale_y_continuous(expand = expansion(mult = c(0, .1))) # Add 2 units of space on the left and right of the data ggplot(subset(diamonds, carat > 2), aes(cut, clarity)) + geom_jitter() + scale_x_discrete(expand = expansion(add = 2)) # Reproduce the default range expansion used # when the 'expand' argument is not specified ggplot(subset(diamonds, carat > 2), aes(cut, price)) + geom_jitter() + scale_x_discrete(expand = expansion(add = .6)) + scale_y_continuous(expand = expansion(mult = .05)) </pre> <hr /><div style="text-align: center;">[Package <em>ggplot2</em> version 3.3.2 <a href="00Index.html">Index</a>]</div> </body></html>