R/simple_plots.R
scatter.plot.diagonal.RdMake customized scatter plot with diagonal line and R2 printed.
scatter.plot.diagonal( data, x, y, size0 = 0.2, alpha0 = 0.3, dilute = FALSE, add_abline = FALSE, add_hist = TRUE, add_stat_cor = TRUE )
| data | dataset |
|---|---|
| x | x |
| y | y |
| size0 | point size, default to 1 of nobs<1000, 0.4 if nobs>1000 |
| alpha0 | alpha of point |
| dilute | a number or logical, dafault to TRUE, will plot
|
| add_abline | default to FALSE, add a diagonal line |
| add_hist | optional to add marginal histogram using
|
| add_stat_cor | add correlation and p-value from |
ggplot2 object if add_hist = FALSE
scatter.plot.diagonal(data = iris, x = "Sepal.Length", y = "Petal.Length")#> [1] "R2 is 0.76 ."#>#>