corscatterplot function

corscatterplot

corscatterplot

draw cor scatter plot with density plot by ggplot2

corscatterplot( dat, x, y, color_cor = "blue", fill_cor = "lightgray", fill_x = "#ff820e", fill_y = "#0000fe", type = "density", ... )

Arguments

  • dat: plot data
  • x: x
  • y: y
  • color_cor: color for cor reg.line
  • fill_cor: fill for cor reg.line
  • fill_x: fill for top density plot
  • fill_y: fill for right density plot
  • type: whether to use a density plot or a histogram plot for the side panel.
  • ...: other paramters for ggscatter

Returns

a ggplot object

Examples

if(requireNamespace("ggpubr",quietly = TRUE)){ corscatterplot(iris,"Sepal.Length","Sepal.Width") }else{ warning("Package 'ggpubr' needed for this function to work. Please install it by install.packages('ggpubr')") }

Author(s)

Xiaojie Sun

  • Maintainer: Xiaojie Sun
  • License: MIT + file LICENSE
  • Last published: 2025-03-05