gaussplotR
gaussplotR: Fit, Predict and Plot 2D-Gaussians in R - Published in JOSS (2021)
Science Score: 100.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 8 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
2d-gaussian
gaussian
gaussian-fit
gaussian-interpolation
gaussian-plot
gaussian-volume
plotting
r
rstats
Last synced: 4 months ago
·
JSON representation
·
Repository
🔔 Fit, predict, and plot 2D Gaussians in R
Basic Info
- Host: GitHub
- Owner: vbaliga
- License: gpl-3.0
- Language: HTML
- Default Branch: master
- Homepage: https://vbaliga.github.io/gaussplotR/
- Size: 10.2 MB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 13
Topics
2d-gaussian
gaussian
gaussian-fit
gaussian-interpolation
gaussian-plot
gaussian-volume
plotting
r
rstats
Created over 5 years ago
· Last pushed over 4 years ago
Metadata Files
Readme
Changelog
Contributing
License
Citation
Codemeta
README.Rmd
---
output: github_document
---
```{r opts, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
dpi = 300
)
```
# gaussplotR
[](https://www.repostatus.org/#active)
[](https://github.com/vbaliga/gaussplotR/actions)
[](https://codecov.io/gh/vbaliga/gaussplotR?branch=master)
[](https://joss.theoj.org/papers/10.21105/joss.03074)
[](https://doi.org/10.5281/zenodo.4041073)
[](https://CRAN.R-project.org/package=gaussplotR)
`gaussplotR` provides functions to fit two-dimensional Gaussian functions,
predict values from such functions, and produce plots of predicted data.
## Installation
You can install `gaussplotR` from CRAN via:
``` {r install_cran, eval = FALSE}
install.packages("gaussplotR")
```
Or to get the latest (developmental) version through GitHub, use:
``` {r install_github, eval = FALSE}
devtools::install_github("vbaliga/gaussplotR")
```
## Example
The function `fit_gaussian_2D()` is the workhorse of `gaussplotR`. It uses
`stats::nls()` to find the best-fitting parameters of a 2D-Gaussian fit to
supplied data based on one of three formula choices. The function
`autofit_gaussian_2D()` can be used to automatically figure out the best formula
choice and arrive at the best-fitting parameters.
The `predict_gaussian_2D()` function can then be used to predict values from
the Gaussian over a supplied grid of X- and Y-values (generated here via
`expand.grid()`). This is useful if the original data is relatively sparse and
interpolation of values is desired.
Plotting can then be achieved via `ggplot_gaussian_2D()`, but note that the
`data.frame` created by `predict_gaussian_2D()` can be supplied to other
plotting frameworks such as `lattice::levelplot()`. A 3D plot can also be
produced via `rgl_gaussian_2D()` (not shown here).
```{r example}
library(gaussplotR)
## Load the sample data set
data(gaussplot_sample_data)
## The raw data we'd like to use are in columns 1:3
samp_dat <-
gaussplot_sample_data[,1:3]
#### Example 1: Unconstrained elliptical ####
## This fits an unconstrained elliptical by default
gauss_fit_ue <-
fit_gaussian_2D(samp_dat)
## Generate a grid of X- and Y- values on which to predict
grid <-
expand.grid(X_values = seq(from = -5, to = 0, by = 0.1),
Y_values = seq(from = -1, to = 4, by = 0.1))
## Predict the values using predict_gaussian_2D
gauss_data_ue <-
predict_gaussian_2D(
fit_object = gauss_fit_ue,
X_values = grid$X_values,
Y_values = grid$Y_values,
)
## Plot via ggplot2 and metR
library(ggplot2); library(metR)
ggplot_gaussian_2D(gauss_data_ue)
## And another example plot via lattice::levelplot()
library(lattice)
lattice::levelplot(
predicted_values ~ X_values * Y_values,
data = gauss_data_ue,
col.regions = colorRampPalette(
c("white", "blue")
)(100),
asp = 1
)
#### Example 2: Constrained elliptical_log ####
## This fits a constrained elliptical, as in Priebe et al. 2003
gauss_fit_cel <-
fit_gaussian_2D(
samp_dat,
method = "elliptical_log",
constrain_orientation = -1
)
## Generate a grid of x- and y- values on which to predict
grid <-
expand.grid(X_values = seq(from = -5, to = 0, by = 0.1),
Y_values = seq(from = -1, to = 4, by = 0.1))
## Predict the values using predict_gaussian_2D
gauss_data_cel <-
predict_gaussian_2D(
fit_object = gauss_fit_cel,
X_values = grid$X_values,
Y_values = grid$Y_values,
)
## Plot via ggplot2 and metR
ggplot_gaussian_2D(gauss_data_cel)
```
Should you be interested in having `gaussplotR` try to automatically determine
the best choice of `method` for `fit_gaussian_2D()`, the `autofit_gaussian_2D()`
function can come in handy. The default is to select the `method` that
produces a fit with the lowest `rmse`, but other choices include `rss` and
`AIC`.
```{r autofit}
## Use autofit_gaussian_2D() to automatically decide the best
## model to use
gauss_auto <-
autofit_gaussian_2D(
samp_dat,
comparison_method = "rmse",
simplify = TRUE
)
## The output has the same components as `fit_gaussian_2D()`
## but for the automatically-selected best-fitting method only:
summary(gauss_auto)
```
## Contributing and/or raising Issues
Feedback on bugs, improvements, and/or feature requests are all welcome.
Please see the Issues templates on GitHub to make a bug fix request or feature
request.
To contribute code via a pull request, please consult the Contributing Guide
first.
## Citation
Baliga, VB. 2021. gaussplotR: Fit, predict, and plot 2D-Gaussians in R. Journal of Open Source Software, 6(60), 3074. https://doi.org/10.21105/joss.03074
## License
GPL (>= 3) + file LICENSE
🐢
Owner
- Name: Vikram Baliga
- Login: vbaliga
- Kind: user
- Location: Vancouver, B.C.
- Company: @ubc
- Website: https://vbaliga.github.io/
- Repositories: 3
- Profile: https://github.com/vbaliga
Animal locomotory behavior + (macro)evolution; Research Associate at @ubc Zoology
JOSS Publication
gaussplotR: Fit, Predict and Plot 2D-Gaussians in R
Published
April 06, 2021
Volume 6, Issue 60, Page 3074
Authors
Tags
2D-Gaussian Gaussian fit Gaussian orientation nonlinear least squaresCitation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Baliga" given-names: "Vikram B." orcid: "https://orcid.org/0000-0002-9367-8974" title: "gaussplotR" version: 0.2.6 doi: 10.21105/joss.03074 date-released: 2021-07-29 url: "https://github.com/vbaliga/gaussplotR"
CodeMeta (codemeta.json)
{
"@context": [
"https://doi.org/10.5063/schema/codemeta-2.0",
"http://schema.org"
],
"@type": "SoftwareSourceCode",
"identifier": "gaussplotR",
"description": "\n Functions to fit two-dimensional Gaussian functions, predict values from\n fits, and produce plots of predicted data via either 'ggplot2' or base R \n plotting.",
"name": "gaussplotR: Fit, Predict and Plot 2D Gaussians",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.2.6",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.0.2 (2020-06-22)",
"author": [
{
"@type": "Person",
"givenName": "Vikram B.",
"familyName": "Baliga",
"email": "vbaliga87@gmail.com",
"@id": "https://orcid.org/0000-0002-9367-8974"
}
],
"contributor": {},
"copyrightHolder": [
{
"@type": "Person",
"givenName": "Vikram B.",
"familyName": "Baliga",
"email": "vbaliga87@gmail.com",
"@id": "https://orcid.org/0000-0002-9367-8974"
}
],
"funder": {},
"maintainer": [
{
"@type": "Person",
"givenName": "Vikram B.",
"familyName": "Baliga",
"email": "vbaliga87@gmail.com",
"@id": "https://orcid.org/0000-0002-9367-8974"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "lattice",
"name": "lattice",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=lattice"
},
{
"@type": "SoftwareApplication",
"identifier": "knitr",
"name": "knitr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=knitr"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
"name": "rmarkdown",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rmarkdown"
},
{
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=testthat"
}
],
"softwareRequirements": [
{
"@type": "SoftwareApplication",
"identifier": "ggplot2",
"name": "ggplot2",
"version": ">= 3.3.0",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggplot2"
},
{
"@type": "SoftwareApplication",
"identifier": "metR",
"name": "metR",
"version": ">= 0.7.0",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=metR"
},
{
"@type": "SoftwareApplication",
"identifier": "rgl",
"name": "rgl",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rgl"
},
{
"@type": "SoftwareApplication",
"identifier": "viridisLite",
"name": "viridisLite",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=viridisLite"
},
{
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 3.3.0"
}
],
"codeRepository": "https://github.com/vbaliga/gaussplotR",
"fileSize": "3498.072KB",
"developmentStatus": "https://www.repostatus.org/#active",
"issueTracker": "https://github.com/vbaliga/gaussplotR/issues",
"keywords": [
"gaussian",
"r",
"rstats",
"gaussian-interpolation",
"gaussian-plot",
"plotting",
"gaussian-volume",
"2d-gaussian",
"gaussian-fit"
],
"releaseNotes": "https://github.com/vbaliga/gaussplotR/blob/master/NEWS.md",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"relatedLink": "https://CRAN.R-project.org/package=gaussplotR",
"contIntegration": "https://codecov.io/gh/vbaliga/gaussplotR?branch=master",
"citation": [
{
"@type": "ScholarlyArticle",
"datePublished": "2021",
"author": [
{
"@type": "Person",
"givenName": "Vikram B.",
"familyName": "Baliga",
"@id": "https://orcid.org/0000-0002-9367-8974"
}
],
"name": "gaussplotR: Fit, Predict and Plot 2D-Gaussians in R",
"identifier": "10.21105/joss.03074",
"pagination": "3074",
"@id": "https://doi.org/10.21105/joss.03074",
"sameAs": "https://doi.org/10.21105/joss.03074",
"isPartOf": {
"@type": "PublicationIssue",
"issueNumber": "60",
"datePublished": "2021",
"isPartOf": {
"@type": [
"PublicationVolume",
"Periodical"
],
"volumeNumber": "6",
"name": "Journal of Open Source Software"
}
}
}
]
}
GitHub Events
Total
Last Year
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Vikram Baliga | v****7@g****m | 102 |
| Daniel S. Katz | d****z@i****g | 1 |
Committer Domains (Top 20 + Academic)
ieee.org: 1
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 1.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- danielskatz (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 262 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
cran.r-project.org: gaussplotR
Fit, Predict and Plot 2D Gaussians
- Homepage: https://github.com/vbaliga/gaussplotR
- Documentation: http://cran.r-project.org/web/packages/gaussplotR/gaussplotR.pdf
- License: GPL-3
-
Latest release: 0.2.5
published over 4 years ago
Rankings
Stargazers count: 26.2%
Forks count: 28.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 35.9%
Downloads: 59.4%
Maintainers (1)
Last synced:
4 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.3.0 depends
- ggplot2 >= 3.3.0 imports
- metR >= 0.7.0 imports
- rgl * imports
- viridisLite * imports
- knitr * suggests
- lattice * suggests
- rmarkdown * suggests
- testthat * suggests
