ggscatridges

This is a useful function to help the user to better visualise the distribution between sample groups using density plots combined to a scatter plot.

https://github.com/matbou85/ggscatridges

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.2%) to scientific vocabulary

Keywords

ggplot2 ggridges plotting r
Last synced: 6 months ago · JSON representation

Repository

This is a useful function to help the user to better visualise the distribution between sample groups using density plots combined to a scatter plot.

Basic Info
  • Host: GitHub
  • Owner: matbou85
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 1.51 MB
Statistics
  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
ggplot2 ggridges plotting r
Created over 2 years ago · Last pushed 9 months ago
Metadata Files
Readme License

README.md

ggScatRidges: Scatter Plot Combined with Ridgelines in 'ggplot2'

ggScatRidges is a simple function combining a scatter plot to a ridgeline plot to visualise the disparities of the data points. This helps visualising the distribution of different groups in the data.

An example of a plot that this package generates

Installation

Please install the stable release from CRAN:

r install.packages("ggScatRidges")

Alternatively, you can install the latest development version from github:

r remotes::install_github("matbou85/ggScatRidges")

Basic usage

``` r library(ggScatRidges)

ggScatRidges(x = iris$Sepal.Length, y = iris$Sepal.Width, group= iris$Species, color = "lancet", ridges = TRUE, title = "plot iris", legend.title = "Grouping", xlab = "Sepal.Length", ylab = "Sepal.Width", basesize = 15, size = 2, draw = TRUE, density2d = TRUE, legend = TRUE, label = FALSE, text = NULL) ```

Change parameters: remove legend, change points shape and size

```r library(ggScatRidges)

ggScatRidges(x = iris$Sepal.Length, y = iris$Sepal.Width, group= iris$Species, color = "lancet", ridges = TRUE, title = "plot iris", xlab = "Sepal.Length", ylab = "Sepal.Width", basesize = 15, size = 3, draw = TRUE, density2d = FALSE, legend = FALSE, label = FALSE, text = NULL, pch = c(10,12,14)) ```

An example of a plot that this package generates

Add stats

```r library(ggScatRidges)

ggScatRidges(x = iris$Sepal.Length, y = iris$Sepal.Width, group= iris$Species, color = "lancet", ridges = TRUE, title = "plot iris", xlab = "Sepal.Length", ylab = "Sepal.Width", basesize = 15, size = 3, draw = TRUE, density2d = FALSE, legend = FALSE, label = FALSE, text = NULL, pch = c(10,12,14), stats = TRUE, statsmethod = "eu", annosize = 6, anno_pos = "Up") ```

An example of a plot that this package generates

PCA usage application

``` r library(ggScatRidges) library(factoextra)

pca <- prcomp(iris[,1:4]) PC1=pca$x[,1] PC2=pca$x[,2] eig.val <- get_eigenvalue(pca) xlab <- paste0("PC1: ", round(eig.val[1,3], digits = 1), "% variance") ylab <- paste0("PC2: ", round(eig.val[2,3] - eig.val[1,3], digits = 1), "% variance")

ggScatRidges(x = PC1, y = PC2, group= iris$Species, color = "lancet", ridges = TRUE, title = "PCA iris", xlab = xlab, ylab = ylab, size = 2, draw = TRUE, density_2d = TRUE, legend = TRUE, label = FALSE, text = NULL)

```

An example of a plot that this package generates

Plot from dataframe

``` r library(ggScatRidges) library(dplyr)

iris2 <- iris[,c(1,2,5)] ## The first column will be used as 'x', the second as 'y' and the third as group for plotting. iris2 <- iris2 %>% group_by(Species) %>% slice(1:10) iris2$name <- c(1:30) ## The fourth column is used for naming.

ggScatRidges(x = iris2, color = "lancet", ridges = TRUE, title = "plot iris", xlab = "Sepal.Length", ylab = "Sepal.width", size = 2, draw = TRUE, density_2d = FALSE, legend = TRUE, label = TRUE)

```

An example of a plot that this package generates

This function is loosely inspired by one of the plots in a post by Alboukadel Kassambara from 2017.

Owner

  • Name: Matthieu Bourgery
  • Login: matbou85
  • Kind: user

GitHub Events

Total
  • Watch event: 1
  • Push event: 4
Last Year
  • Watch event: 1
  • Push event: 4

Packages

  • Total packages: 1
  • Total downloads:
    • cran 254 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: ggScatRidges

Scatter Plot Combined with Ridgelines in 'ggplot2'

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 254 Last month
Rankings
Dependent packages count: 28.7%
Dependent repos count: 36.8%
Average: 50.5%
Downloads: 86.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • cowplot * imports
  • ggplot2 * imports
  • ggpubr * imports
  • ggridges * imports
  • hrbrthemes * imports
  • viridis * imports