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.

coord_cartesian(xlim = NULL, ylim = NULL, expand = TRUE,
default = FALSE, clip = "on")

## Arguments

xlim, ylim |
Limits for the x and y axes. |

expand |
If `TRUE` , the default, adds a small expansion factor to
the limits to ensure that data and axes don't overlap. If `FALSE` ,
limits are taken exactly from the data or `xlim` /`ylim` . |

default |
Is this the default coordinate system? If `FALSE` |

clip |
Should drawing be clipped to the extent of the plot panel? A
setting of `"on"` (the default) means yes, and a setting of `"off"`
means no. In most cases, the default of `"on"` should not be changed,
as setting `clip = "off"` can cause unexpected results. It allows
drawing of data points anywhere on the plot, including in the plot margins. If
limits are set via `xlim` and `ylim` 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. |

## Examples

#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'

#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'

#> Warning: Removed 24 rows containing non-finite values (stat_smooth).

#> Warning: Removed 24 rows containing missing values (geom_point).

# 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))

#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'

# 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)

#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'

# Simiarly, we can use expand = FALSE to turn off expansion with the
# default limits
p + coord_cartesian(expand = FALSE)

#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'

#> Warning: Removed 17502 rows containing non-finite values (stat_bin2d).

# When zooming the coordinate system, we see a subset of original 50 bins,
# displayed bigger
d + coord_cartesian(xlim = c(0, 1))