EVOLUTION-MANAGER
Edit File: coord_cartesian.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: Cartesian coordinates</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 coord_cartesian {ggplot2}"><tr><td>coord_cartesian {ggplot2}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Cartesian coordinates</h2> <h3>Description</h3> <p>The Cartesian coordinate system is the most familiar, and common, type of coordinate system. Setting limits on the coordinate system will zoom the plot (like you're looking at it with a magnifying glass), and will not change the underlying data like setting limits on a scale will. </p> <h3>Usage</h3> <pre> coord_cartesian( xlim = NULL, ylim = NULL, expand = TRUE, default = FALSE, clip = "on" ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>xlim, ylim</code></td> <td> <p>Limits for the x and y axes.</p> </td></tr> <tr valign="top"><td><code>expand</code></td> <td> <p>If <code>TRUE</code>, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If <code>FALSE</code>, limits are taken exactly from the data or <code>xlim</code>/<code>ylim</code>.</p> </td></tr> <tr valign="top"><td><code>default</code></td> <td> <p>Is this the default coordinate system? If <code>FALSE</code> (the default), then replacing this coordinate system with another one creates a message alerting the user that the coordinate system is being replaced. If <code>TRUE</code>, that warning is suppressed.</p> </td></tr> <tr valign="top"><td><code>clip</code></td> <td> <p>Should drawing be clipped to the extent of the plot panel? A setting of <code>"on"</code> (the default) means yes, and a setting of <code>"off"</code> means no. In most cases, the default of <code>"on"</code> should not be changed, as setting <code>clip = "off"</code> can cause unexpected results. It allows drawing of data points anywhere on the plot, including in the plot margins. If limits are set via <code>xlim</code> and <code>ylim</code> and some data points fall outside those limits, then those data points may show up in places such as the axes, the legend, the plot title, or the plot margins.</p> </td></tr> </table> <h3>Examples</h3> <pre> # There are two ways of zooming the plot display: with scales or # with coordinate systems. They work in two rather different ways. p <- ggplot(mtcars, aes(disp, wt)) + geom_point() + geom_smooth() p # Setting the limits on a scale converts all values outside the range to NA. p + scale_x_continuous(limits = c(325, 500)) # Setting the limits on the coordinate system performs a visual zoom. # The data is unchanged, and we just view a small portion of the original # plot. Note how smooth continues past the points visible on this plot. p + coord_cartesian(xlim = c(325, 500)) # By default, the same expansion factor is applied as when setting scale # limits. You can set the limits precisely by setting expand = FALSE p + coord_cartesian(xlim = c(325, 500), expand = FALSE) # Simiarly, we can use expand = FALSE to turn off expansion with the # default limits p + coord_cartesian(expand = FALSE) # You can see the same thing with this 2d histogram d <- ggplot(diamonds, aes(carat, price)) + stat_bin2d(bins = 25, colour = "white") d # When zooming the scale, the we get 25 new bins that are the same # size on the plot, but represent smaller regions of the data space d + scale_x_continuous(limits = c(0, 1)) # When zooming the coordinate system, we see a subset of original 50 bins, # displayed bigger d + coord_cartesian(xlim = c(0, 1)) </pre> <hr /><div style="text-align: center;">[Package <em>ggplot2</em> version 3.3.2 <a href="00Index.html">Index</a>]</div> </body></html>