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.
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
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
Statistics
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
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.

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)) ```

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") ```

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)
```

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)
```

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
- Repositories: 1
- Profile: https://github.com/matbou85
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'
- Homepage: https://github.com/matbou85/ggScatRidges
- Documentation: http://cran.r-project.org/web/packages/ggScatRidges/ggScatRidges.pdf
- License: GPL-3
-
Latest release: 0.1.2
published 9 months ago
Rankings
Maintainers (1)
Dependencies
- cowplot * imports
- ggplot2 * imports
- ggpubr * imports
- ggridges * imports
- hrbrthemes * imports
- viridis * imports