diff options
| author | Chris Sobczak <chris@sobczak.family> | 2026-06-17 00:23:03 -0700 |
|---|---|---|
| committer | Chris Sobczak <chris@sobczak.family> | 2026-06-17 00:23:03 -0700 |
| commit | c9febb74dddab29b7e60488c91564796387f2785 (patch) | |
| tree | 389dc3744bec3568dd2621eb9ed75ede3efb4bee | |
| parent | c9155f21e709ff2d2b84f132f2e8bdf62f0078b8 (diff) | |
Rename corplot to heatmap
| -rw-r--r-- | NAMESPACE | 2 | ||||
| -rw-r--r-- | R/heatmap.R (renamed from R/corplot.R) | 8 | ||||
| -rw-r--r-- | README.Rmd | 2 | ||||
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | man/figures/README-example-1.png | bin | 48834 -> 50206 bytes | |||
| -rw-r--r-- | man/heatmap.Rd (renamed from man/corplot.Rd) | 14 | ||||
| -rw-r--r-- | tests/testthat/text-heatmap.R (renamed from tests/testthat/test-corplot.R) | 2 |
7 files changed, 20 insertions, 15 deletions
@@ -1,7 +1,7 @@ # Generated by roxygen2: do not edit by hand -export(corplot) export(gg_csobczak) +export(heatmap) export(networkplot) import(ggplot2) import(ggraph) diff --git a/R/corplot.R b/R/heatmap.R index e849a92..569f0ec 100644 --- a/R/corplot.R +++ b/R/heatmap.R @@ -1,6 +1,6 @@ -#' Correlation Plot (Upper Triangle) +#' Heatmap Plot (Upper Triangle) #' -#' Minimal ggplot2 correlation plot showing the upper triangle +#' Minimal ggplot2 relationship structure plot showing the upper triangle #' in the top-right corner with no axis labels. #' @param R A square numeric correlation matrix #' @param title Optional plot title @@ -10,12 +10,12 @@ #' @examples #' X <- matrix(data = rnorm(100), nrow = 10) #' R <- cor(X) -#' corplot(R, title = 'Example Correlation Plot') +#' heatmap(R, title = 'Example Correlation Plot') #' #' @importFrom reshape2 melt #' @import ggplot2 #' @export -corplot <- function(R, title = NULL){ +heatmap <- function(R, title = NULL){ R_list <- tryCatch({ if(is.matrix(R)){ cnames <- colnames(R) @@ -37,7 +37,7 @@ library(csobczak.r) library(patchwork) X <- matrix(data = rnorm(100), nrow = 10) R <- cor(X) -p1 <- corplot(R, title = 'Example Correlation Plot') +p1 <- heatmap(R, title = 'Example Correlation Plot') p2 <- networkplot(R, title = 'Example Network Plot') p1 + p2 ``` @@ -25,10 +25,15 @@ pak::pkg_install('git::https://codeberg.org/csobczak/csobczak.r') ``` r library(csobczak.r) +#> +#> Attaching package: 'csobczak.r' +#> The following object is masked from 'package:stats': +#> +#> heatmap library(patchwork) X <- matrix(data = rnorm(100), nrow = 10) R <- cor(X) -p1 <- corplot(R, title = 'Example Correlation Plot') +p1 <- heatmap(R, title = 'Example Correlation Plot') p2 <- networkplot(R, title = 'Example Network Plot') p1 + p2 ``` diff --git a/man/figures/README-example-1.png b/man/figures/README-example-1.png Binary files differindex a5e59b1..a15dc43 100644 --- a/man/figures/README-example-1.png +++ b/man/figures/README-example-1.png diff --git a/man/corplot.Rd b/man/heatmap.Rd index a27d577..51472de 100644 --- a/man/corplot.Rd +++ b/man/heatmap.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/corplot.R -\name{corplot} -\alias{corplot} -\title{Correlation Plot (Upper Triangle)} +% Please edit documentation in R/heatmap.R +\name{heatmap} +\alias{heatmap} +\title{Heatmap Plot (Upper Triangle)} \usage{ -corplot(R, title = NULL) +heatmap(R, title = NULL) } \arguments{ \item{R}{A square numeric correlation matrix} @@ -15,12 +15,12 @@ corplot(R, title = NULL) A ggplot object } \description{ -Minimal ggplot2 correlation plot showing the upper triangle +Minimal ggplot2 relationship structure plot showing the upper triangle in the top-right corner with no axis labels. } \examples{ X <- matrix(data = rnorm(100), nrow = 10) R <- cor(X) -corplot(R, title = 'Example Correlation Plot') +heatmap(R, title = 'Example Correlation Plot') } diff --git a/tests/testthat/test-corplot.R b/tests/testthat/text-heatmap.R index 2aecdc1..94ea14e 100644 --- a/tests/testthat/test-corplot.R +++ b/tests/testthat/text-heatmap.R @@ -1,5 +1,5 @@ test_that("returns a ggplot object", { x <- matrix(data = rnorm(100), nrow = 10) - p <- corplot(x) + p <- heatmap(x) inherits(p, 'ggplot') }) |
