── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.3.6 ✔ purrr 0.3.5
✔ tibble 3.1.8 ✔ dplyr 1.0.10
✔ tidyr 1.2.1 ✔ stringr 1.4.1
✔ readr 2.1.3 ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
13 coord()
coor_flip(); coor_fixed(); coor_polar(); coor_trans()
13.1 xlim,ylim
p0<-ggplot(mpg, aes(displ, hwy))+geom_point()+geom_smooth();p0`geom_smooth()` using method = 'loess' and formula 'y ~ x'

p0+scale_x_continuous(limits = c(5, 7))`geom_smooth()` using method = 'loess' and formula 'y ~ x'
Warning: Removed 196 rows containing non-finite values (stat_smooth).
Warning: Removed 196 rows containing missing values (geom_point).

p1<-ggplot(mpg,aes(displ,hwy))+geom_bin2d(bins=30);p1
p1+scale_x_continuous(limits = c(5, 7))Warning: Removed 196 rows containing non-finite values (stat_bin2d).

p1+coord_cartesian(xlim = c(5, 7))
13.2 coord_flip()
# 使用coord_flip()交换x/y轴#
p+coord_flip()
13.3 coord_fixed()
#坐标轴比例coord_fixed()#
p+coord_fixed(ratio=1/5)
13.4 coord_polar
#极坐标coord_polar(theta = "x/y")#
p+coord_polar(theta = "y",start=pi/2,direction=1)
13.5 coord_trans()
d <- subset(diamonds, carat > 0.5)
ggplot(d, aes(carat, price)) + geom_point()+ geom_smooth(method = "lm")`geom_smooth()` using formula 'y ~ x'

ggplot(d, aes(log10(carat), log10(price))) + geom_point()+ geom_smooth(method = "lm")`geom_smooth()` using formula 'y ~ x'

ggplot(d, aes(carat, price)) + geom_point() + geom_smooth(method = "lm")+
scale_x_log10()+scale_y_log10()`geom_smooth()` using formula 'y ~ x'

ggplot(d, aes(carat, price)) + geom_point() + geom_smooth(method = "lm")+
coord_trans(x = "log10", y = "log10")`geom_smooth()` using formula 'y ~ x'

ggplot(d, aes(carat, price)) + geom_point() + geom_smooth(method = "lm") +
scale_x_log10() + scale_y_log10() +
coord_trans(x = scales::exp_trans(10), y = scales::exp_trans(10))`geom_smooth()` using formula 'y ~ x'
Warning in trans$inverse(continuous_range_coord): NaNs produced
Warning in self$trans$y$inverse(panel_params$y.range): NaNs produced
Warning in self$trans$y$inverse(panel_params$y.range): NaNs produced
Warning in self$trans$y$inverse(panel_params$y.range): NaNs produced


