View source: R/coord_obs_pred.R
coord_obs_pred | R Documentation |
For regression models, coord_obs_pred()
can be used in a ggplot to make the
x- and y-axes have the same exact scale along with an aspect ratio of one.
coord_obs_pred(ratio = 1, xlim = NULL, ylim = NULL, expand = TRUE, clip = "on")
ratio |
Aspect ratio, expressed as |
xlim , ylim |
Limits for the x and y axes. |
expand |
Not currently used. |
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 |
A ggproto
object.
data(solubility_test, package = "modeldata")
library(ggplot2)
p <- ggplot(solubility_test, aes(x = solubility, y = prediction)) +
geom_abline(lty = 2) +
geom_point(alpha = 0.5)
p
p + coord_fixed()
p + coord_obs_pred()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.