library(tidyverse)
stdz <- function(x){
(x-mean(x))/ sd(x)
}
mtcars %>%
ggplot() +
aes(x = stdz(wt)) +
aes(y = stdz(mpg)) +
geom_point() +
coord_equal()
ggplot(mtcars) +
aes(x = wt, y = mpg) +
geom_point() +
coord_equal(sd(mtcars$wt)/sd(mtcars$mpg), clip = "off") +
geom_point(data = tibble(y = mean(mtcars$mpg) +
-2:2*sd(mtcars$mpg)),
aes(y = y),
shape = "-", x = Inf) +
geom_text(data = tibble(y = mean(mtcars$mpg) +
-2:2*sd(mtcars$mpg)),
aes(y = y), label = -2:2, hjust = -1.2,
x = Inf)
hate it :-)