├── .github ├── .gitignore ├── ISSUE_TEMPLATE.md └── workflows │ └── R-CMD-check.yaml ├── vignettes ├── .gitignore ├── .install_extras ├── ggcoef_model.Rmd ├── ggally_stats.Rmd ├── glyph.Rmd ├── ggscatmat.Rmd └── ggsurv.Rmd ├── scripts ├── build_site.R ├── rhub.R ├── psychademic.R └── revdepcheck.R ├── data ├── flea.rda ├── happy.rda ├── nasa.rda ├── pigs.rda ├── tips.rda ├── baseball.rda ├── psychademic.rda ├── nba_ppg_2008.rda ├── twitter_spambots.rda └── australia_PISA2012.rda ├── .vscode ├── extensions.json └── settings.json ├── R ├── ggsave.R ├── zzz.R ├── utils-pipe.R ├── GGally-package.R ├── utils.R ├── data-twitter_spambots.R ├── data-tips.R ├── data-nasa.R ├── data-psychademic.R ├── data-flea.R ├── reexports.R ├── data-pigs.R ├── data-baseball.R ├── vig_ggally.R ├── ggmatrix_make_plot.R ├── ggmatrix_progress.R ├── data-happy.R └── ggmatrix_print.R ├── revdep ├── .gitignore ├── README.md ├── revdep_cran.md └── cran.md ├── man-roxygen ├── ggmatrix-labeller-param.R ├── ggmatrix-progress.R ├── ggmatrix-switch-param.R └── ggmatrix-legend-param.R ├── notes ├── color.R ├── old-codecov.yml ├── strip-top.R └── correlation.R ├── tests ├── testthat │ ├── helper-options.R │ ├── test-ggsave.R │ ├── _snaps │ │ ├── ggcorr.md │ │ ├── ggmatrix_add.md │ │ ├── gg-plots.md │ │ ├── ggnostic.md │ │ ├── ggscatmat.md │ │ ├── deprecated.md │ │ ├── ggnetworkmap.md │ │ ├── ggsurv.md │ │ ├── ggmatrix_getput.md │ │ ├── crosstalk.md │ │ ├── wrap.md │ │ ├── gglegend │ │ │ ├── custom.svg │ │ │ ├── points.svg │ │ │ └── plotnew-default.svg │ │ └── ggmatrix.md │ ├── test-vig_ggally.R │ ├── helper-doppelganger.R │ ├── test-ggcoef.R │ ├── test-deprecated.R │ ├── test-crosstalk.R │ ├── test-ggscatmat.R │ ├── test-wrap.R │ ├── test-ggfacet.R │ ├── test-ggmatrix_getput.R │ ├── test-ggtable.R │ ├── test-ggbivariate.R │ └── test-ggmatrix_add.R ├── spelling.R └── testthat.R ├── data-raw └── nba_ppg_2008.R ├── man ├── is_date.Rd ├── brew_colors.Rd ├── plotting_data_type.Rd ├── print_if_interactive.Rd ├── mapping_color_to_fill.Rd ├── get_x_axis_labels.Rd ├── skewness.Rd ├── plot_types.Rd ├── mapping_string.Rd ├── pipe.Rd ├── is_ggmatrix.Rd ├── is_blank_plot.Rd ├── mapping_swap_x_y.Rd ├── rescale01.Rd ├── ggally_blank.Rd ├── eval_data_col.Rd ├── str.ggmatrix.Rd ├── add_ref_lines.Rd ├── column_is_character.Rd ├── find_plot_type.Rd ├── scag_order.Rd ├── ggally_na.Rd ├── print.ggmatrix.Rd ├── vig_ggally.Rd ├── ggts.Rd ├── remove_color_unless_equal.Rd ├── ggally_facetdensitystrip.Rd ├── add_and_overwrite_aes.Rd ├── ggally_facethist.Rd ├── add_ref_boxes.Rd ├── ggally_facetbar.Rd ├── is_horizontal.Rd ├── getPlot.Rd ├── ggally_denstrip.Rd ├── ggally_facetdensity.Rd ├── lowertriangle.Rd ├── ggally_barDiag.Rd ├── model_terms.Rd ├── ggally_points.Rd ├── ggally_densityDiag.Rd ├── twitter_spambots.Rd ├── broomify.Rd ├── tips.Rd ├── nasa.Rd ├── singleClassOrder.Rd ├── uppertriangle.Rd ├── ggmatrix_gtable.Rd ├── ggmatrix_progress.Rd ├── ggally_dot_and_box.Rd ├── ggally_box.Rd ├── psychademic.Rd ├── flea.Rd ├── ggally_nostic_std_resid.Rd ├── scatmat.Rd ├── ggally_dot.Rd ├── ggally_density.Rd ├── ggally_text.Rd ├── glyphplot.Rd ├── grab_legend.Rd ├── pigs.Rd ├── reexports.Rd ├── figures │ ├── lifecycle-defunct.svg │ ├── lifecycle-archived.svg │ ├── lifecycle-maturing.svg │ ├── lifecycle-deprecated.svg │ ├── lifecycle-superseded.svg │ ├── lifecycle-questioning.svg │ ├── lifecycle-experimental.svg │ ├── lifecycle-soft-deprecated.svg │ └── lifecycle-stable.svg ├── fn_switch.Rd ├── ggally_ratio.Rd ├── ggscatmat.Rd ├── ggally_smooth.Rd ├── ggally_diagAxis.Rd ├── ggally_nostic_cooksd.Rd ├── v1_ggmatrix_theme.Rd ├── ggally_nostic_sigma.Rd ├── baseball.Rd ├── ggally_autopoint.Rd ├── ggally_nostic_line.Rd ├── ggally_nostic_se_fit.Rd ├── putPlot.Rd ├── ggally_count.Rd ├── nba_ppg_2008.Rd ├── gglegend.Rd ├── happy.Rd ├── GGally-package.Rd ├── ggally_nostic_resid.Rd ├── ggtable.Rd ├── glyphs.Rd ├── ggally_trends.Rd ├── ggally_nostic_hat.Rd ├── ggally_crosstable.Rd ├── ggally_cor_v1_5.Rd ├── ggally_statistic.Rd ├── ggbivariate.Rd ├── ggally_cross.Rd └── ggfacet.Rd ├── .gitignore ├── ggally.Rproj ├── .Rbuildignore ├── README.md ├── .helper_functions ├── inst └── WORDLIST └── cran-comments.md /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /scripts/build_site.R: -------------------------------------------------------------------------------- 1 | pkgdown::build_site() 2 | -------------------------------------------------------------------------------- /data/flea.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/flea.rda -------------------------------------------------------------------------------- /data/happy.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/happy.rda -------------------------------------------------------------------------------- /data/nasa.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/nasa.rda -------------------------------------------------------------------------------- /data/pigs.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/pigs.rda -------------------------------------------------------------------------------- /data/tips.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/tips.rda -------------------------------------------------------------------------------- /data/baseball.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/baseball.rda -------------------------------------------------------------------------------- /data/psychademic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/psychademic.rda -------------------------------------------------------------------------------- /data/nba_ppg_2008.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/nba_ppg_2008.rda -------------------------------------------------------------------------------- /data/twitter_spambots.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/twitter_spambots.rda -------------------------------------------------------------------------------- /data/australia_PISA2012.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ggobi/ggally/HEAD/data/australia_PISA2012.rda -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "Posit.air-vscode" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /R/ggsave.R: -------------------------------------------------------------------------------- 1 | #' @export 2 | # @examples 3 | # ggsave("test.pdf", ggpairs(iris, 1:2)) 4 | grid.draw.ggmatrix <- function(x, ...) { 5 | print(x) 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[r]": { 3 | "editor.formatOnSave": true, 4 | "editor.defaultFormatter": "Posit.air-vscode" 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /scripts/rhub.R: -------------------------------------------------------------------------------- 1 | rhub_output <- devtools::check_rhub( 2 | env_vars = c("_R_CHECK_FORCE_SUGGESTS_" = "0"), 3 | interactive = FALSE 4 | ) 5 | rhub_output$web() 6 | -------------------------------------------------------------------------------- /vignettes/.install_extras: -------------------------------------------------------------------------------- 1 | ggcoef.html 2 | ggduo.html 3 | gglyph.html 4 | ggmatrix.html 5 | ggnetworkmap.html 6 | ggpairs.html 7 | ggscatmat.html 8 | ggsurv.html 9 | -------------------------------------------------------------------------------- /revdep/.gitignore: -------------------------------------------------------------------------------- 1 | checks 2 | library 3 | checks.noindex 4 | library.noindex 5 | data.sqlite 6 | *.html 7 | *.rds 8 | lib 9 | *.noindex* 10 | *.nosync* 11 | failures.md 12 | -------------------------------------------------------------------------------- /man-roxygen/ggmatrix-labeller-param.R: -------------------------------------------------------------------------------- 1 | #' @param labeller labeller for facets. See \code{\link[ggplot2]{labellers}}. Common values are \code{"label_value"} (default) and \code{"label_parsed"}. 2 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onLoad <- function(...) { 2 | registerS3method("print", "glyphplot", `_print_glyphplot`) 3 | registerS3method("print", "legend_guide_box", `_print_legend_guide_box`) 4 | 5 | S7::methods_register() 6 | } 7 | -------------------------------------------------------------------------------- /notes/color.R: -------------------------------------------------------------------------------- 1 | mtcars 2 | 3 | ggparcoord(mtcars, columns = c(1, 3:6), mapping = aes(linewidth = gear)) 4 | 5 | 6 | dt <- melt(mtcars, c("mpg", "cyl", "disp", "hp", "drat", "wt", "qsec")) 7 | qplot(mpg, value, data = dt, color = variable, geom = "line") 8 | -------------------------------------------------------------------------------- /tests/testthat/helper-options.R: -------------------------------------------------------------------------------- 1 | rq <- function(...) { 2 | suppressPackageStartupMessages(require(..., quietly = TRUE)) 3 | } 4 | 5 | with_options <- function(opts, expr) { 6 | old_opts <- options(opts) 7 | on.exit(options(old_opts)) 8 | force(expr) 9 | } 10 | -------------------------------------------------------------------------------- /notes/old-codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | bot: schloerke 3 | 4 | coverage: 5 | range: "70...95" 6 | status: 7 | patch: 8 | default: 9 | branches: 10 | - main 11 | - dev 12 | target: '80' 13 | project: 14 | default: 15 | branches: 16 | - main 17 | - dev 18 | -------------------------------------------------------------------------------- /data-raw/nba_ppg_2008.R: -------------------------------------------------------------------------------- 1 | ## code to prepare `nba_ppg_2008` dataset goes here 2 | 3 | # https://flowingdata.com/2010/01/21/how-to-make-a-heatmap-a-quick-and-easy-solution/ 4 | nba_ppg_2008 <- read.csv( 5 | "http://datasets.flowingdata.com/ppg2008.csv", 6 | sep = "," 7 | ) 8 | 9 | usethis::use_data(nba_ppg_2008, overwrite = TRUE) 10 | -------------------------------------------------------------------------------- /man/is_date.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/find-combo.R 3 | \name{is_date} 4 | \alias{is_date} 5 | \title{Check if object is a date} 6 | \usage{ 7 | is_date(x) 8 | } 9 | \arguments{ 10 | \item{x}{vector} 11 | } 12 | \description{ 13 | Check if object is a date 14 | } 15 | \keyword{internal} 16 | -------------------------------------------------------------------------------- /man-roxygen/ggmatrix-progress.R: -------------------------------------------------------------------------------- 1 | #' @param progress \code{NULL} (default) for a progress bar in interactive sessions with more than 15 plots, \code{TRUE} for a progress bar, \code{FALSE} for no progress bar, or a function that accepts at least a plot matrix and returns a new \code{progress::\link[progress]{progress_bar}}. See \code{\link{ggmatrix_progress}}. 2 | -------------------------------------------------------------------------------- /man-roxygen/ggmatrix-switch-param.R: -------------------------------------------------------------------------------- 1 | #' @param switch switch parameter for facet_grid. See \code{ggplot2::\link[ggplot2]{facet_grid}}. By default, the labels are displayed on the top and right of the plot. If \code{"x"}, the top labels will be displayed to the bottom. If \code{"y"}, the right-hand side labels will be displayed to the left. Can also be set to \code{"both"} 2 | -------------------------------------------------------------------------------- /tests/spelling.R: -------------------------------------------------------------------------------- 1 | # `devtools::spell_check()` 2 | 3 | # only check spelling if on CI and spelling is available 4 | if (requireNamespace("spelling", quietly = TRUE)) { 5 | if (isTRUE(as.logical(Sys.getenv("CI")))) { 6 | spelling::spell_check_test( 7 | vignettes = TRUE, 8 | error = FALSE, 9 | skip_on_cran = TRUE 10 | ) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/testthat/test-ggsave.R: -------------------------------------------------------------------------------- 1 | test_that("ggsave", { 2 | pm <- ggpairs(iris, 1:2) 3 | 4 | test_file <- "test.pdf" 5 | 6 | on.exit({ 7 | unlink(test_file) 8 | }) 9 | 10 | expect_true(!file.exists(test_file)) 11 | 12 | expect_silent({ 13 | ggsave(test_file, pm, width = 7, height = 7) 14 | }) 15 | 16 | expect_true(file.exists(test_file)) 17 | }) 18 | -------------------------------------------------------------------------------- /man/brew_colors.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{brew_colors} 4 | \alias{brew_colors} 5 | \title{RColorBrewer Set1 colors} 6 | \usage{ 7 | brew_colors(col) 8 | } 9 | \arguments{ 10 | \item{col}{standard color name used to retrieve hex color value} 11 | } 12 | \description{ 13 | RColorBrewer Set1 colors 14 | } 15 | -------------------------------------------------------------------------------- /man/plotting_data_type.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/find-combo.R 3 | \name{plotting_data_type} 4 | \alias{plotting_data_type} 5 | \title{Get plotting data type} 6 | \usage{ 7 | plotting_data_type(x) 8 | } 9 | \arguments{ 10 | \item{x}{vector} 11 | } 12 | \description{ 13 | Get plotting data type 14 | } 15 | \keyword{internal} 16 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/ggcorr.md: -------------------------------------------------------------------------------- 1 | # further options 2 | 3 | Code 4 | ggcorr(flea[, -1], layout.exp = "a") 5 | Condition 6 | Error in `ggcorr()`: 7 | ! incorrect `layout.exp` value 8 | 9 | # other geoms 10 | 11 | Code 12 | ggcorr(flea[, -1], geom = "hexbin") 13 | Condition 14 | Error in `ggcorr()`: 15 | ! incorrect geom value 16 | 17 | -------------------------------------------------------------------------------- /tests/testthat/test-vig_ggally.R: -------------------------------------------------------------------------------- 1 | test_that("all vignetts are accounted for", { 2 | testthat::skip_on_cran() 3 | 4 | # make sure vig dir exists 5 | vig_dir <- file.path("..", "..", "vignettes") 6 | testthat::skip_if_not(dir.exists(vig_dir)) 7 | 8 | vigs <- dir(vig_dir, pattern = "\\.Rmd$") 9 | vigs <- sub(".Rmd", "", vigs, fixed = TRUE) 10 | expect_setequal(vignettes_for_ggally, vigs) 11 | }) 12 | -------------------------------------------------------------------------------- /man/print_if_interactive.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{print_if_interactive} 4 | \alias{print_if_interactive} 5 | \title{Print if not CRAN} 6 | \usage{ 7 | print_if_interactive(p) 8 | } 9 | \arguments{ 10 | \item{p}{plot to be displayed} 11 | } 12 | \description{ 13 | Small function to print a plot if the R session is interactive or in a CI build 14 | } 15 | -------------------------------------------------------------------------------- /R/utils-pipe.R: -------------------------------------------------------------------------------- 1 | #' Pipe operator 2 | #' 3 | #' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. 4 | #' 5 | #' @name %>% 6 | #' @rdname pipe 7 | #' @keywords internal 8 | #' @export 9 | #' @importFrom magrittr %>% 10 | #' @usage lhs \%>\% rhs 11 | #' @param lhs A value or the magrittr placeholder. 12 | #' @param rhs A function call using the magrittr semantics. 13 | #' @return The result of calling `rhs(lhs)`. 14 | NULL 15 | -------------------------------------------------------------------------------- /man/mapping_color_to_fill.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggpairs.R 3 | \name{mapping_color_to_fill} 4 | \alias{mapping_color_to_fill} 5 | \title{Aesthetic mapping color fill} 6 | \usage{ 7 | mapping_color_to_fill(current) 8 | } 9 | \arguments{ 10 | \item{current}{the current aesthetics} 11 | } 12 | \description{ 13 | Replace the fill with the color and make color NULL. 14 | } 15 | -------------------------------------------------------------------------------- /revdep/README.md: -------------------------------------------------------------------------------- 1 | # Revdeps 2 | 3 | ## New problems (4) 4 | 5 | |package |version |error |warning |note | 6 | |:--------|:-------|:------|:-------|:----| 7 | |[comparer](problems.md#comparer)|0.2.4 |__+1__ | |1 | 8 | |[ezEDA](problems.md#ezeda)|0.1.1 |__+1__ | | | 9 | |[rbioacc](problems.md#rbioacc)|1.2.1 |__+1__ | |2 | 10 | |[tidycomm](problems.md#tidycomm)|0.4.1 |__+1__ | | | 11 | 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .Rhistory 3 | ..Rcheck 4 | *ggmapTemp.png 5 | tests/testthat/Rplots.pdf 6 | vignettes/figure 7 | vignettes/docs.html 8 | vignettes/rd.html 9 | vignettes/docs_cache/ 10 | vignettes/docs_files/ 11 | vignettes/assets/ 12 | vignettes/rd_cache/ 13 | vignettes/rd_files/ 14 | .Rproj.user 15 | .RData 16 | .lintr_cache 17 | _gh-pages 18 | ggduo_paper.txt 19 | .httr-oauth 20 | docs 21 | inst/doc 22 | doc 23 | Meta 24 | CRAN-RELEASE 25 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | # This file is part of the standard setup for testthat. 2 | # It is recommended that you do not modify it. 3 | # 4 | # Where should you do additional test configuration? 5 | # Learn more about the roles of various files in: 6 | # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview 7 | # * https://testthat.r-lib.org/articles/special-files.html 8 | 9 | library(testthat) 10 | library(GGally) 11 | 12 | test_check("GGally") 13 | -------------------------------------------------------------------------------- /man/get_x_axis_labels.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{get_x_axis_labels} 4 | \alias{get_x_axis_labels} 5 | \title{Get x axis labels} 6 | \usage{ 7 | get_x_axis_labels(p, xRange) 8 | } 9 | \arguments{ 10 | \item{p}{plot object} 11 | 12 | \item{xRange}{range of x values} 13 | } 14 | \description{ 15 | Retrieves x axis labels from the plot object directly. 16 | } 17 | \keyword{internal} 18 | -------------------------------------------------------------------------------- /man/skewness.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggparcoord.R 3 | \name{skewness} 4 | \alias{skewness} 5 | \title{Sample skewness} 6 | \usage{ 7 | skewness(x) 8 | } 9 | \arguments{ 10 | \item{x}{numeric vector} 11 | } 12 | \value{ 13 | sample skewness of \code{x} 14 | } 15 | \description{ 16 | Calculate the sample skewness of a vector 17 | while ignoring missing values. 18 | } 19 | \author{ 20 | Jason Crowley 21 | } 22 | -------------------------------------------------------------------------------- /man/plot_types.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/find-combo.R 3 | \name{plot_types} 4 | \alias{plot_types} 5 | \title{Plot Types} 6 | \usage{ 7 | plot_types(data, columnsX, columnsY, allowDiag = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{data set to be used} 11 | } 12 | \description{ 13 | Retrieves the type of plot that should be used for all combinations 14 | } 15 | \author{ 16 | Barret Schloerke 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /ggally.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,namespace 22 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/ggmatrix_add.md: -------------------------------------------------------------------------------- 1 | # add 2 | 3 | Code 4 | pm + 3 5 | Condition 6 | Error in `+.ggmatrix`: 7 | ! `ggmatrix()` does not know how to add objects that do not have class , or . 8 | i Received object with class: 9 | 10 | # v1_ggmatrix_theme 11 | 12 | Code 13 | pm <- ggpairs(tips, 1:2) 14 | pm1 <- pm + v1_ggmatrix_theme() 15 | expect_true(is.null(pm$gg)) 16 | expect_true(!is.null(pm1$gg)) 17 | 18 | -------------------------------------------------------------------------------- /man/mapping_string.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{mapping_string} 4 | \alias{mapping_string} 5 | \title{Aes name} 6 | \usage{ 7 | mapping_string(aes_col) 8 | } 9 | \arguments{ 10 | \item{aes_col}{Single value from \code{ggplot2::\link[ggplot2]{aes}(...)}} 11 | } 12 | \value{ 13 | character string 14 | } 15 | \description{ 16 | Aes name 17 | } 18 | \examples{ 19 | mapping <- ggplot2::aes(Petal.Length) 20 | mapping_string(mapping$x) 21 | } 22 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/gg-plots.md: -------------------------------------------------------------------------------- 1 | # cor 2 | 3 | Code 4 | ggally_cor(ti, ggplot2::aes(x = total_bill, y = tip, color = size)) 5 | Condition 6 | Error in `ggally_statistic()`: 7 | ! `mapping` color column must be categorical, not numeric 8 | 9 | # diagAxis 10 | 11 | Code 12 | ggally_diagAxis(iris, mapping = ggplot2::aes(y = Sepal.Length)) 13 | Condition 14 | Error in `ggally_diagAxis()`: 15 | ! mapping$x is null. There must be a column value in this location. 16 | 17 | -------------------------------------------------------------------------------- /man/pipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils-pipe.R 3 | \name{\%>\%} 4 | \alias{\%>\%} 5 | \title{Pipe operator} 6 | \usage{ 7 | lhs \%>\% rhs 8 | } 9 | \arguments{ 10 | \item{lhs}{A value or the magrittr placeholder.} 11 | 12 | \item{rhs}{A function call using the magrittr semantics.} 13 | } 14 | \value{ 15 | The result of calling \code{rhs(lhs)}. 16 | } 17 | \description{ 18 | See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/is_ggmatrix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggpairs_add.R 3 | \name{is_ggmatrix} 4 | \alias{is_ggmatrix} 5 | \title{Check if an object is a ggmatrix} 6 | \usage{ 7 | is_ggmatrix(x) 8 | } 9 | \arguments{ 10 | \item{x}{An object to check} 11 | } 12 | \value{ 13 | Logical value indicating if the object is a \code{ggmatrix} 14 | } 15 | \description{ 16 | Check if an object is a ggmatrix 17 | } 18 | \examples{ 19 | is_ggmatrix(ggpairs(mtcars)) 20 | is_ggmatrix(ggplot2::ggplot()) 21 | } 22 | -------------------------------------------------------------------------------- /man/is_blank_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggmatrix_print.R 3 | \name{is_blank_plot} 4 | \alias{is_blank_plot} 5 | \title{Is Blank Plot? 6 | Find out if the plot equals a blank plot} 7 | \usage{ 8 | is_blank_plot(p) 9 | } 10 | \description{ 11 | Is Blank Plot? 12 | Find out if the plot equals a blank plot 13 | } 14 | \examples{ 15 | GGally:::is_blank_plot(ggally_blank()) 16 | GGally:::is_blank_plot(ggally_points(mtcars, ggplot2::aes(disp, hp))) 17 | 18 | } 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /revdep/revdep_cran.md: -------------------------------------------------------------------------------- 1 | ## revdepcheck results 2 | 3 | We checked 113 reverse dependencies (88 from CRAN + 25 from BioConductor), comparing R CMD check results across CRAN and dev versions of this package. 4 | 5 | * We saw 1 new problems 6 | * We failed to check 1 packages 7 | 8 | Issues with CRAN packages are summarised below. 9 | 10 | ### New problems 11 | (This reports the first line of each new failure) 12 | 13 | * bootcluster 14 | checking whether package ‘bootcluster’ can be installed ... WARNING 15 | 16 | ### Failed to check 17 | 18 | * loon.ggplot (NA) -------------------------------------------------------------------------------- /revdep/cran.md: -------------------------------------------------------------------------------- 1 | ## revdepcheck results 2 | 3 | We checked 141 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. 4 | 5 | * We saw 4 new problems 6 | * We failed to check 0 packages 7 | 8 | Issues with CRAN packages are summarised below. 9 | 10 | ### New problems 11 | (This reports the first line of each new failure) 12 | 13 | * comparer 14 | checking tests ... ERROR 15 | 16 | * ezEDA 17 | checking tests ... ERROR 18 | 19 | * rbioacc 20 | checking tests ... ERROR 21 | 22 | * tidycomm 23 | checking tests ... ERROR 24 | 25 | -------------------------------------------------------------------------------- /man/mapping_swap_x_y.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{mapping_swap_x_y} 4 | \alias{mapping_swap_x_y} 5 | \title{Swap x and y mapping} 6 | \usage{ 7 | mapping_swap_x_y(mapping) 8 | } 9 | \arguments{ 10 | \item{mapping}{output of \code{ggplot2::\link[ggplot2]{aes}(...)}} 11 | } 12 | \value{ 13 | Aes mapping with the x and y values switched 14 | } 15 | \description{ 16 | Swap x and y mapping 17 | } 18 | \examples{ 19 | mapping <- ggplot2::aes(Petal.Length, Sepal.Width) 20 | mapping 21 | mapping_swap_x_y(mapping) 22 | } 23 | -------------------------------------------------------------------------------- /man/rescale01.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gglyph.R 3 | \name{rescale01} 4 | \alias{rescale01} 5 | \alias{range01} 6 | \alias{max1} 7 | \alias{mean0} 8 | \alias{min0} 9 | \alias{rescale11} 10 | \title{Rescaling functions} 11 | \usage{ 12 | range01(x) 13 | 14 | max1(x) 15 | 16 | mean0(x) 17 | 18 | min0(x) 19 | 20 | rescale01(x, xlim = NULL) 21 | 22 | rescale11(x, xlim = NULL) 23 | } 24 | \arguments{ 25 | \item{x}{numeric vector} 26 | 27 | \item{xlim}{value used in \code{range}} 28 | } 29 | \description{ 30 | Rescaling functions 31 | } 32 | -------------------------------------------------------------------------------- /notes/strip-top.R: -------------------------------------------------------------------------------- 1 | library(gtable) 2 | library(grid) 3 | library(ggplot) 4 | 5 | qplot(total_bill, tip, data = tips) + facet_grid(time ~ day) -> p 6 | p 7 | ggplot_gtable(ggplot_build(p)) -> x 8 | gtable_show_layout(x) 9 | 10 | qplot(total_bill, tip, data = tips, main = "test\ntitle") + 11 | facet_grid(time ~ day) -> p 12 | p 13 | ggplot_gtable(ggplot_build(p)) -> x2 14 | gtable_show_layout(x2) 15 | 16 | grid.draw(gtable_filter(x, "strip-top")) 17 | grid.draw(gtable_filter(x, "strip-top")[1, ]) 18 | 19 | gtable_show_layout(x) 20 | gtable_show_layout(x2) 21 | 22 | str(x2, max.level = 2) 23 | x2$heights[[3]] 24 | -------------------------------------------------------------------------------- /man/ggally_blank.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_blank} 4 | \alias{ggally_blank} 5 | \alias{ggally_blankDiag} 6 | \title{Blank plot} 7 | \usage{ 8 | ggally_blank(...) 9 | 10 | ggally_blankDiag(...) 11 | } 12 | \arguments{ 13 | \item{...}{other arguments ignored} 14 | } 15 | \description{ 16 | Draws nothing. 17 | } 18 | \details{ 19 | Makes a "blank" ggplot object that will only draw white space 20 | } 21 | \seealso{ 22 | \code{\link[ggplot2:element]{ggplot2::element_blank()}} 23 | } 24 | \author{ 25 | Barret Schloerke 26 | } 27 | \keyword{hplot} 28 | -------------------------------------------------------------------------------- /R/GGally-package.R: -------------------------------------------------------------------------------- 1 | #' @keywords internal 2 | "_PACKAGE" 3 | 4 | # The following block is used by usethis to automatically manage 5 | # roxygen namespace tags. Modify with care! 6 | ## usethis namespace: start 7 | #' @importFrom lifecycle deprecate_soft 8 | #' @importFrom lifecycle deprecated 9 | ## usethis namespace: end 10 | NULL 11 | 12 | #' @import S7 13 | # > ...import the S7 package into your namespace. 14 | # https://github.com/RConsortium/S7/issues/530#issuecomment-2730659813 15 | NULL 16 | 17 | # enable usage of @name in package code 18 | #' @rawNamespace if (getRversion() < "4.3.0") importFrom("S7", "@") 19 | NULL 20 | -------------------------------------------------------------------------------- /man/eval_data_col.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{eval_data_col} 4 | \alias{eval_data_col} 5 | \title{Evaluate data column} 6 | \usage{ 7 | eval_data_col(data, aes_col) 8 | } 9 | \arguments{ 10 | \item{data}{data set to evaluate the data with} 11 | 12 | \item{aes_col}{Single value from an \code{ggplot2::\link[ggplot2]{aes}(...)} object} 13 | } 14 | \value{ 15 | Aes mapping with the x and y values switched 16 | } 17 | \description{ 18 | Evaluate data column 19 | } 20 | \examples{ 21 | mapping <- ggplot2::aes(Petal.Length) 22 | eval_data_col(iris, mapping$x) 23 | } 24 | -------------------------------------------------------------------------------- /man/str.ggmatrix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggpairs_internal_plots.R 3 | \name{str.ggmatrix} 4 | \alias{str.ggmatrix} 5 | \title{\code{\link{ggmatrix}} structure} 6 | \arguments{ 7 | \item{object}{\code{\link{ggmatrix}} object to be viewed} 8 | 9 | \item{...}{passed on to the default \code{str} method} 10 | 11 | \item{raw}{boolean to determine if the plots should be converted to text or kept as original objects} 12 | } 13 | \description{ 14 | View the condensed version of the \code{\link{ggmatrix}} object. The attribute "class" is ALWAYS altered to "_class" to avoid recursion. 15 | } 16 | -------------------------------------------------------------------------------- /vignettes/ggcoef_model.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ggcoef_model(): Model coefficients" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{ggcoef_model(): Model coefficients} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | Redirecting to https://larmarange.github.io/ggstats/articles/ggcoef_model.html 11 | 12 | To view locally, run the R command `vignette("ggcoef_model", "ggstats")`. 13 | 14 | 15 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | TODO 2 | ..Rcheck 3 | .DS_Store 4 | .gitignore 5 | R/.DS_Store 6 | .git 7 | ^\.github 8 | .travis.yml 9 | .helper_functions 10 | .lintr.* 11 | figure 12 | ggmapTemp.png 13 | README.html 14 | notes/ 15 | tests/testthat/_snaps 16 | tests/testthat/Rplots.pdf 17 | ^.*\.Rproj$ 18 | ^\.Rproj\.user$ 19 | ^cran-comments\.md$ 20 | ^codecov\.yml$ 21 | vigs/ 22 | _gh-pages 23 | ggduo_paper.txt 24 | ^man-roxygen 25 | ^\.httr-oauth$ 26 | ^scripts/ 27 | ^revdep$ 28 | ^\.github/ 29 | ^_pkgdown\.yml$ 30 | ^docs$ 31 | ^pkgdown$ 32 | ^\.github$ 33 | ^doc$ 34 | ^Meta$ 35 | ^CRAN-RELEASE$ 36 | ^vignettes$ 37 | ^CRAN-SUBMISSION$ 38 | .vscode 39 | ^data-raw$ 40 | -------------------------------------------------------------------------------- /man/add_ref_lines.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gglyph.R 3 | \name{add_ref_lines} 4 | \alias{add_ref_lines} 5 | \title{Add reference lines for each cell of the glyphmap.} 6 | \usage{ 7 | add_ref_lines(data, color = "white", size = 1.5, ...) 8 | } 9 | \arguments{ 10 | \item{data}{A glyphmap structure.} 11 | 12 | \item{color}{Set the color to draw in, default is "white"} 13 | 14 | \item{size}{Set the line size, default is 1.5} 15 | 16 | \item{...}{other arguments passed onto \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}}} 17 | } 18 | \description{ 19 | Add reference lines for each cell of the glyphmap. 20 | } 21 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/ggnostic.md: -------------------------------------------------------------------------------- 1 | # fn_switch 2 | 3 | Code 4 | fn(dummy_dt, ggplot2::aes(value = !!as.name("B"))) 5 | Condition 6 | Error in `fn()`: 7 | ! function could not be found for `value` or `default`. Please include one of these two keys as a function. 8 | 9 | # error checking 10 | 11 | Code 12 | get_cols(c("not_there", ".fitted", ".se.fit", ".resid", ".std.resid", ".sigma", 13 | ".hat", ".cooksd")) 14 | Condition 15 | Error in `match_nostic_columns()`: 16 | ! Could not match `columnsY`: "not_there" to choices: "mpg", ".fitted", ".se.fit", ".resid", ".hat", ".sigma", ".cooksd", and ".std.resid" 17 | 18 | -------------------------------------------------------------------------------- /man/column_is_character.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggparcoord.R 3 | \name{column_is_character} 4 | \alias{column_is_character} 5 | \alias{column_is_factor} 6 | \title{Get vector of variable types from data frame} 7 | \usage{ 8 | column_is_character(df) 9 | 10 | column_is_factor(df) 11 | } 12 | \arguments{ 13 | \item{df}{data frame to extract variable types from} 14 | } 15 | \value{ 16 | character vector with variable types, with names corresponding to 17 | the variable names from df 18 | } 19 | \description{ 20 | Get vector of variable types from data frame 21 | } 22 | \author{ 23 | Jason Crowley 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/ggscatmat.md: -------------------------------------------------------------------------------- 1 | # stops 2 | 3 | Code 4 | ggscatmat(flea, columns = c(1, 2)) 5 | Condition 6 | Error in `ggscatmat()`: 7 | ! Not enough numeric variables to make a scatter plot matrix 8 | 9 | --- 10 | 11 | Code 12 | ggscatmat(flea, columns = c(1, 1, 1)) 13 | Condition 14 | Error in `ggscatmat()`: 15 | ! All of your variables are factors. Need numeric variables to make scatter plot matrix. 16 | 17 | --- 18 | 19 | Code 20 | scatmat(flea, columns = c(1, 1, 1)) 21 | Condition 22 | Error in `scatmat()`: 23 | ! All of your variables are factors. Need numeric variables to make scatterplot matrix. 24 | 25 | -------------------------------------------------------------------------------- /man/find_plot_type.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/find-combo.R 3 | \name{find_plot_type} 4 | \alias{find_plot_type} 5 | \title{Find plot types} 6 | \usage{ 7 | find_plot_type(col1Name, col2Name, type1, type2, isAllNa, allowDiag) 8 | } 9 | \arguments{ 10 | \item{col1Name}{x column name} 11 | 12 | \item{col2Name}{y column name} 13 | 14 | \item{type1}{x column type} 15 | 16 | \item{type2}{y column type} 17 | 18 | \item{isAllNa}{is.na(data)} 19 | 20 | \item{allowDiag}{allow for diag values to be returned} 21 | } 22 | \description{ 23 | Retrieves the type of plot for the specific columns 24 | } 25 | \author{ 26 | Barret Schloerke 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/deprecated.md: -------------------------------------------------------------------------------- 1 | # v1_ggmatrix_theme() is deprecated 2 | 3 | Code 4 | v1_ggmatrix_theme() 5 | Output 6 | List of 2 7 | $ strip.background: 8 | ..@ fill : chr "white" 9 | ..@ colour : NULL 10 | ..@ linewidth : NULL 11 | ..@ linetype : NULL 12 | ..@ linejoin : NULL 13 | ..@ inherit.blank: logi FALSE 14 | $ strip.placement : chr "outside" 15 | @ complete: logi FALSE 16 | @ validate: logi TRUE 17 | 18 | # ggally_cor_v1_5() is deprecated 19 | 20 | Code 21 | p <- ggally_cor_v1_5(tips, ggplot2::aes(!!as.name("total_bill"), !!as.name( 22 | "tip"))) 23 | 24 | -------------------------------------------------------------------------------- /tests/testthat/helper-doppelganger.R: -------------------------------------------------------------------------------- 1 | ggally_expect_doppelganger <- function(name, plot) { 2 | if (packageVersion("ggplot2") < "3.5.2.9001") { 3 | # Keep snapshot around, but skip the test 4 | vdiffr__str_standardise <- getFromNamespace("str_standardise", "vdiffr") 5 | file <- paste0( 6 | vdiffr__str_standardise(name), 7 | ".svg" 8 | ) 9 | testthat::announce_snapshot_file(name = file) 10 | # Go through the whole process of writing the SVG 11 | # to ensure that the file can be created, using all the gtable code 12 | vdiffr::write_svg(plot, tempfile(file, fileext = ".svg")) 13 | expect_true(TRUE) # Avoid empty test 14 | } else { 15 | vdiffr::expect_doppelganger(name, plot) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /man/scag_order.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggparcoord.R 3 | \name{scag_order} 4 | \alias{scag_order} 5 | \title{Find order of variables} 6 | \usage{ 7 | scag_order(scag, vars, measure) 8 | } 9 | \arguments{ 10 | \item{scag}{\code{scagnostics} object} 11 | 12 | \item{vars}{character vector of the variables to be ordered} 13 | 14 | \item{measure}{scagnostics measure to order according to} 15 | } 16 | \value{ 17 | character vector of variable ordered according to the given 18 | scagnostic measure 19 | } 20 | \description{ 21 | Find order of variables based on a specified scagnostic measure 22 | by maximizing the index values of that measure along the path. 23 | } 24 | \author{ 25 | Barret Schloerke 26 | } 27 | -------------------------------------------------------------------------------- /man/ggally_na.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_na} 4 | \alias{ggally_na} 5 | \alias{ggally_naDiag} 6 | \title{NA plot} 7 | \usage{ 8 | ggally_na(data = NULL, mapping = NULL, size = 10, color = "grey20", ...) 9 | 10 | ggally_naDiag(...) 11 | } 12 | \arguments{ 13 | \item{data}{ignored} 14 | 15 | \item{mapping}{ignored} 16 | 17 | \item{size}{size of the geom_text 'NA'} 18 | 19 | \item{color}{color of the geom_text 'NA'} 20 | 21 | \item{...}{other arguments sent to geom_text} 22 | } 23 | \description{ 24 | Draws a large \code{NA} in the middle of the plotting area. This plot is useful when all X or Y data is \code{NA} 25 | } 26 | \author{ 27 | Barret Schloerke 28 | } 29 | \keyword{hplot} 30 | -------------------------------------------------------------------------------- /man-roxygen/ggmatrix-legend-param.R: -------------------------------------------------------------------------------- 1 | #' @param legend May be the two objects described below or the default \code{NULL} value. The legend position can be moved by using ggplot2's theme element \code{pm + theme(legend.position = "bottom")} \describe{\item{a numeric vector of length 2}{provides the location of the plot to use the legend for the plot matrix's legend. Such as \code{legend = c(3,5)} which will use the legend from the plot in the third row and fifth column}\item{a single numeric value}{provides the location of a plot according to the display order. Such as \code{legend = 3} in a plot matrix with 2 rows and 5 columns displayed by column will return the plot in position \code{c(1,2)}}\item{a object from \code{\link{grab_legend}()}}{a predetermined plot legend that will be displayed directly}} 2 | -------------------------------------------------------------------------------- /man/print.ggmatrix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggmatrix_print.R 3 | \name{print.ggmatrix} 4 | \alias{print.ggmatrix} 5 | \title{Print \code{\link{ggmatrix}} object} 6 | \arguments{ 7 | \item{x}{plot to display} 8 | 9 | \item{newpage}{draw new (empty) page first?} 10 | 11 | \item{vp}{viewport to draw plot in} 12 | 13 | \item{...}{arguments passed onto \code{\link{ggmatrix_gtable}}} 14 | } 15 | \description{ 16 | Print method taken from \code{ggplot2:::print.ggplot} and altered for a \code{\link{ggmatrix}} object 17 | } 18 | \examples{ 19 | data(tips) 20 | pMat <- ggpairs(tips, c(1, 3, 2), mapping = ggplot2::aes(color = sex)) 21 | pMat # calls print(pMat), which calls print.ggmatrix(pMat) 22 | } 23 | \author{ 24 | Barret Schloerke 25 | } 26 | -------------------------------------------------------------------------------- /tests/testthat/test-ggcoef.R: -------------------------------------------------------------------------------- 1 | suppressMessages(require(broom)) 2 | 3 | test_that("example", { 4 | reg <- lm( 5 | Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, 6 | data = iris 7 | ) 8 | p <- ggcoef(reg) 9 | ggally_expect_doppelganger("lm", p) 10 | 11 | skip_if_not_installed("MASS") 12 | d <- as.data.frame(Titanic) 13 | reg2 <- glm( 14 | Survived ~ Sex + Age + Class, 15 | family = binomial, 16 | data = d, 17 | weights = d$Freq 18 | ) 19 | p <- ggcoef(reg2, exponentiate = TRUE) 20 | ggally_expect_doppelganger("lm-expo", p) 21 | p <- ggcoef( 22 | reg2, 23 | exponentiate = TRUE, 24 | exclude_intercept = TRUE, 25 | errorbar_height = .2, 26 | color = "blue" 27 | ) 28 | ggally_expect_doppelganger("lm-expo-blue", p) 29 | }) 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please briefly describe your problem and what output you expect. If you have a general question, please try using [RStudio Community](https://community.rstudio.com/tags/c/general/17/ggally) first. 2 | 3 | Please include a minimal reprex. The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it. If you've never heard of a reprex before, start by reading , and follow the advice further down the page. Do NOT include session info unless it's explicitly asked for, or you've used `reprex::reprex(..., si = TRUE)` to hide it away. 4 | 5 | Delete these instructions once you have read them. 6 | 7 | --- 8 | 9 | Brief description of the problem 10 | 11 | ```r 12 | # insert reprex here 13 | ``` 14 | -------------------------------------------------------------------------------- /man/vig_ggally.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vig_ggally.R 3 | \name{vig_ggally} 4 | \alias{vig_ggally} 5 | \title{View GGally vignettes} 6 | \usage{ 7 | vig_ggally(name) 8 | } 9 | \arguments{ 10 | \item{name}{Vignette name to open. If no name is provided, the vignette index will be opened} 11 | } 12 | \description{ 13 | This function will open the directly to the vignette requested. If no \code{name} is provided, the index of all \pkg{GGally} vignettes will be opened. 14 | } 15 | \details{ 16 | This method allows for vignettes to be hosted remotely, reducing \pkg{GGally}'s package size, and installation time. 17 | } 18 | \examples{ 19 | \donttest{ 20 | # View `ggnostic` vignette 21 | vig_ggally("ggnostic") 22 | 23 | # View all vignettes by GGally 24 | vig_ggally() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /man/ggts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{ggts} 4 | \alias{ggts} 5 | \title{Multiple time series} 6 | \usage{ 7 | ggts(..., columnLabelsX = NULL, xlab = "time") 8 | } 9 | \arguments{ 10 | \item{...}{supplied directly to \code{\link{ggduo}}} 11 | 12 | \item{columnLabelsX}{remove top strips for the X axis by default} 13 | 14 | \item{xlab}{defaults to "time"} 15 | } 16 | \value{ 17 | \code{\link{ggmatrix}} object 18 | } 19 | \description{ 20 | GGally implementation of ts.plot. Wraps around the ggduo function and removes the column strips 21 | } 22 | \examples{ 23 | # Small function to display plots only if it's interactive 24 | p_ <- GGally::print_if_interactive 25 | 26 | p_(ggts(pigs, "time", c("gilts", "profit", "s_per_herdsz", "production", "herdsz"))) 27 | } 28 | -------------------------------------------------------------------------------- /man/remove_color_unless_equal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{remove_color_unless_equal} 4 | \alias{remove_color_unless_equal} 5 | \title{Remove colour mapping unless found in select mapping keys} 6 | \usage{ 7 | remove_color_unless_equal(mapping, to = c("x", "y")) 8 | } 9 | \arguments{ 10 | \item{mapping}{output of \code{ggplot2::\link[ggplot2]{aes}(...)}} 11 | 12 | \item{to}{set of mapping keys to check} 13 | } 14 | \value{ 15 | Aes mapping with colour mapping kept only if found in selected mapping keys. 16 | } 17 | \description{ 18 | Remove colour mapping unless found in select mapping keys 19 | } 20 | \examples{ 21 | mapping <- aes(x = sex, y = age, colour = sex) 22 | 23 | mapping <- aes(x = sex, y = age, colour = region) 24 | remove_color_unless_equal(mapping) 25 | } 26 | -------------------------------------------------------------------------------- /R/utils.R: -------------------------------------------------------------------------------- 1 | #' Print if not CRAN 2 | #' 3 | #' Small function to print a plot if the R session is interactive or in a CI build 4 | #' 5 | #' @param p plot to be displayed 6 | #' @export 7 | print_if_interactive <- function(p) { 8 | if (interactive() || nzchar(Sys.getenv("CAN_PRINT")) || on_ci()) { 9 | print(p) 10 | } 11 | } 12 | on_ci <- function() { 13 | isTRUE(as.logical(Sys.getenv("CI"))) 14 | } 15 | 16 | str_c <- function(..., sep = "", collapse = NULL) { 17 | paste(..., sep = sep, collapse = collapse) 18 | } 19 | 20 | str_detect <- function(string, pattern, ...) { 21 | grepl(pattern, string, ...) 22 | } 23 | 24 | # str_replace <- function(string, pattern, replacement) { 25 | # sub(pattern, replacement, string) 26 | # } 27 | 28 | hf <- function(field) { 29 | eval(parse(text = read.dcf(".helper_functions", fields = field))) 30 | } 31 | -------------------------------------------------------------------------------- /man/ggally_facetdensitystrip.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_facetdensitystrip} 4 | \alias{ggally_facetdensitystrip} 5 | \title{Density or tiles plot with facets} 6 | \usage{ 7 | ggally_facetdensitystrip(data, mapping, ..., den_strip = FALSE) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{other arguments being sent to either geom_histogram or stat_density} 15 | 16 | \item{den_strip}{boolean to decide whether or not to plot a density strip(TRUE) or a facet density(FALSE) plot.} 17 | } 18 | \description{ 19 | Make tile plot or density plot as compact as possible. 20 | } 21 | \examples{ 22 | example(ggally_facetdensity) 23 | example(ggally_denstrip) 24 | } 25 | \author{ 26 | Barret Schloerke 27 | } 28 | \keyword{hplot} 29 | -------------------------------------------------------------------------------- /man/add_and_overwrite_aes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggpairs.R 3 | \name{add_and_overwrite_aes} 4 | \alias{add_and_overwrite_aes} 5 | \title{Add new aes} 6 | \usage{ 7 | add_and_overwrite_aes(current, new) 8 | } 9 | \value{ 10 | aes_ output 11 | } 12 | \description{ 13 | Add new aesthetics to a previous aes. 14 | } 15 | \examples{ 16 | data(diamonds, package = "ggplot2") 17 | diamonds.samp <- diamonds[sample(1:dim(diamonds)[1], 1000), ] 18 | pm <- ggpairs(diamonds.samp, 19 | columns = 5:7, 20 | mapping = ggplot2::aes(color = color), 21 | upper = list(continuous = "cor", mapping = ggplot2::aes(color = clarity)), 22 | lower = list(continuous = "cor", mapping = ggplot2::aes(color = cut)), 23 | title = "Diamonds Sample" 24 | ) 25 | str(pm) 26 | 27 | } 28 | \author{ 29 | Barret Schloerke 30 | } 31 | \keyword{internal} 32 | -------------------------------------------------------------------------------- /man/ggally_facethist.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_facethist} 4 | \alias{ggally_facethist} 5 | \title{Faceted histogram} 6 | \usage{ 7 | ggally_facethist(data, mapping, ...) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{parameters sent to stat_bin()} 15 | } 16 | \description{ 17 | Display subsetted histograms of the data in different panels. 18 | } 19 | \examples{ 20 | # Small function to display plots only if it's interactive 21 | p_ <- GGally::print_if_interactive 22 | 23 | data(tips) 24 | p_(ggally_facethist(tips, mapping = ggplot2::aes(x = tip, y = sex))) 25 | p_(ggally_facethist(tips, mapping = ggplot2::aes(x = tip, y = sex), binwidth = 0.1)) 26 | } 27 | \author{ 28 | Barret Schloerke 29 | } 30 | \keyword{hplot} 31 | -------------------------------------------------------------------------------- /R/data-twitter_spambots.R: -------------------------------------------------------------------------------- 1 | #' Twitter spambots 2 | #' 3 | #' A network of spambots found on Twitter as part of a data mining project. 4 | #' 5 | #' Each node of the network is identified by the Twitter screen name of the 6 | #' account and further carries five vertex attributes: 7 | #' 8 | #' @details \itemize{ 9 | #' \item location user's location, as provided by the user 10 | #' \item lat latitude, based on the user's location 11 | #' \item lon longitude, based on the user's location 12 | #' \item followers number of Twitter accounts that follow this account 13 | #' \item friends number of Twitter accounts followed by the account 14 | #' } 15 | #' 16 | #' @docType data 17 | #' @author Amos Elberg 18 | #' @keywords datasets 19 | #' @name twitter_spambots 20 | #' @usage data(twitter_spambots) 21 | #' @format An object of class \code{network} with 120 edges and 94 vertices. 22 | NULL 23 | -------------------------------------------------------------------------------- /man/add_ref_boxes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gglyph.R 3 | \name{add_ref_boxes} 4 | \alias{add_ref_boxes} 5 | \title{Add reference boxes around each cell of the glyphmap.} 6 | \usage{ 7 | add_ref_boxes( 8 | data, 9 | var_fill = NULL, 10 | color = "white", 11 | size = 0.5, 12 | fill = NA, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{data}{A glyphmap structure.} 18 | 19 | \item{var_fill}{Variable name to use to set the fill color} 20 | 21 | \item{color}{Set the color to draw in, default is "white"} 22 | 23 | \item{size}{Set the line size, default is 0.5} 24 | 25 | \item{fill}{fill value used if \code{var_fill} is \code{NULL}} 26 | 27 | \item{...}{other arguments passed onto \code{\link[ggplot2:geom_tile]{ggplot2::geom_rect()}}} 28 | } 29 | \description{ 30 | Add reference boxes around each cell of the glyphmap. 31 | } 32 | -------------------------------------------------------------------------------- /man/ggally_facetbar.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_facetbar} 4 | \alias{ggally_facetbar} 5 | \title{Faceted bar plot} 6 | \usage{ 7 | ggally_facetbar(data, mapping, ...) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{other arguments are sent to geom_bar} 15 | } 16 | \description{ 17 | X variables are plotted using \code{geom_bar} and are faceted by the Y variable. 18 | } 19 | \examples{ 20 | # Small function to display plots only if it's interactive 21 | p_ <- GGally::print_if_interactive 22 | 23 | data(tips) 24 | p_(ggally_facetbar(tips, ggplot2::aes(x = sex, y = smoker, fill = time))) 25 | p_(ggally_facetbar(tips, ggplot2::aes(x = smoker, y = sex, fill = time))) 26 | } 27 | \author{ 28 | Barret Schloerke 29 | } 30 | \keyword{hplot} 31 | -------------------------------------------------------------------------------- /man/is_horizontal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{is_horizontal} 4 | \alias{is_horizontal} 5 | \alias{is_character_column} 6 | \title{Check if plot is horizontal} 7 | \usage{ 8 | is_horizontal(data, mapping, val = "y") 9 | 10 | is_character_column(data, mapping, val = "y") 11 | } 12 | \arguments{ 13 | \item{data}{data used in ggplot2 plot} 14 | 15 | \item{mapping}{ggplot2 \code{aes()} mapping} 16 | 17 | \item{val}{key to retrieve from \code{mapping}} 18 | } 19 | \value{ 20 | Boolean determining if the data is a character-like data 21 | } 22 | \description{ 23 | Check if plot is horizontal 24 | } 25 | \examples{ 26 | is_horizontal(iris, ggplot2::aes(Sepal.Length, Species)) # TRUE 27 | is_horizontal(iris, ggplot2::aes(Sepal.Length, Species), "x") # FALSE 28 | is_horizontal(iris, ggplot2::aes(Sepal.Length, Sepal.Width)) # FALSE 29 | } 30 | -------------------------------------------------------------------------------- /tests/testthat/test-deprecated.R: -------------------------------------------------------------------------------- 1 | data(tips) 2 | 3 | test_that("ggally_cor_v1_5() works", { 4 | lifecycle::expect_deprecated( 5 | { 6 | p <- ggally_cor_v1_5( 7 | tips, 8 | ggplot2::aes(!!as.name("total_bill"), !!as.name("tip")) 9 | ) 10 | } 11 | ) 12 | }) 13 | 14 | test_that("v1_ggmatrix_theme() is deprecated", { 15 | skip_if(packageVersion("ggplot2") < "3.5.2.9001") 16 | 17 | old_opts <- options(lifecycle_verbosity = "quiet") 18 | on.exit(options(old_opts), add = TRUE) 19 | 20 | expect_snapshot( 21 | v1_ggmatrix_theme() 22 | ) 23 | }) 24 | 25 | test_that("ggally_cor_v1_5() is deprecated", { 26 | old_opts <- options(lifecycle_verbosity = "quiet") 27 | on.exit(options(old_opts), add = TRUE) 28 | 29 | expect_snapshot( 30 | p <- ggally_cor_v1_5( 31 | tips, 32 | ggplot2::aes(!!as.name("total_bill"), !!as.name("tip")) 33 | ) 34 | ) 35 | }) 36 | -------------------------------------------------------------------------------- /R/data-tips.R: -------------------------------------------------------------------------------- 1 | #' Tipping data 2 | #' 3 | #' 4 | #' One waiter recorded information about each tip he received over a 5 | #' period of a few months working in one restaurant. He collected several 6 | #' variables: 7 | #' 8 | #' \itemize{ 9 | #' \item tip in dollars, 10 | #' \item bill in dollars, 11 | #' \item sex of the bill payer, 12 | #' \item whether there were smokers in the party, 13 | #' \item day of the week, 14 | #' \item time of day, 15 | #' \item size of the party. 16 | #' } 17 | #' 18 | #' In all he recorded 244 tips. The data was reported in a collection of 19 | #' case studies for business statistics (Bryant & Smith 1995). 20 | #' 21 | #' @references Bryant, P. G. and Smith, M (1995) \emph{Practical Data 22 | #' Analysis: Case Studies in Business Statistics}. Homewood, IL: Richard D. 23 | #' Irwin Publishing: 24 | #' @format A data frame with 244 rows and 7 variables 25 | #' @keywords datasets 26 | "tips" 27 | -------------------------------------------------------------------------------- /man/getPlot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggpairs_getput.R 3 | \name{getPlot} 4 | \alias{getPlot} 5 | \alias{[.ggmatrix} 6 | \title{Subset a \code{\link{ggmatrix}} object} 7 | \usage{ 8 | getPlot(pm, i, j) 9 | 10 | \method{[}{ggmatrix}(pm, i, j, ...) 11 | } 12 | \arguments{ 13 | \item{pm}{\code{\link{ggmatrix}} object to select from} 14 | 15 | \item{i}{row from the top} 16 | 17 | \item{j}{column from the left} 18 | 19 | \item{...}{ignored} 20 | } 21 | \description{ 22 | Retrieves the ggplot object at the desired location. 23 | } 24 | \examples{ 25 | # Small function to display plots only if it's interactive 26 | p_ <- GGally::print_if_interactive 27 | 28 | data(tips) 29 | plotMatrix2 <- ggpairs(tips[, 3:2], upper = list(combo = "denstrip")) 30 | p_(plotMatrix2[1, 2]) 31 | } 32 | \seealso{ 33 | \code{\link{putPlot}} 34 | } 35 | \author{ 36 | Barret Schloerke 37 | } 38 | \keyword{hplot} 39 | -------------------------------------------------------------------------------- /vignettes/ggally_stats.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "stat_*(): Additional statistics for ggplot2" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{stat_*(): Additional statistics for ggplot2} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | 11 | `{GGally}` reexports three `{ggplot2}` statistics functions from `{ggstats}`. Please see their corresponding vignettes in `{ggstats}` for more details: 12 | * [Compute cross-tabulation statistics with `stat_cross()`](https://larmarange.github.io/ggstats/articles/stat_cross.html) (`vignette("stat_cross", "ggstats")`) 13 | * [Compute custom proportions with `stat_prop()`](https://larmarange.github.io/ggstats/articles/stat_prop.html) (`vignette("stat_prop", "ggstats")`) 14 | * [Compute weighted mean with `stat_weighted_mean()`](https://larmarange.github.io/ggstats/articles/stat_weighted_mean.html) (`vignette("stat_weighted_mean", "ggstats")`) 15 | -------------------------------------------------------------------------------- /man/ggally_denstrip.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_denstrip} 4 | \alias{ggally_denstrip} 5 | \title{Tile plot with facets} 6 | \usage{ 7 | ggally_denstrip(data, mapping, ...) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{other arguments being sent to stat_bin} 15 | } 16 | \description{ 17 | Displays a Tile Plot as densely as possible. 18 | } 19 | \examples{ 20 | # Small function to display plots only if it's interactive 21 | p_ <- GGally::print_if_interactive 22 | 23 | data(tips) 24 | p_(ggally_denstrip(tips, mapping = ggplot2::aes(x = total_bill, y = sex))) 25 | p_(ggally_denstrip( 26 | tips, 27 | mapping = ggplot2::aes(sex, tip), binwidth = 0.2 28 | ) + ggplot2::scale_fill_gradient(low = "grey80", high = "black")) 29 | } 30 | \author{ 31 | Barret Schloerke 32 | } 33 | \keyword{hplot} 34 | -------------------------------------------------------------------------------- /man/ggally_facetdensity.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_facetdensity} 4 | \alias{ggally_facetdensity} 5 | \title{Faceted density plot} 6 | \usage{ 7 | ggally_facetdensity(data, mapping, ...) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{other arguments being sent to stat_density} 15 | } 16 | \description{ 17 | Make density plots by displaying subsets of the data in different panels. 18 | } 19 | \examples{ 20 | # Small function to display plots only if it's interactive 21 | p_ <- GGally::print_if_interactive 22 | 23 | data(tips) 24 | p_(ggally_facetdensity(tips, mapping = ggplot2::aes(x = total_bill, y = sex))) 25 | p_(ggally_facetdensity( 26 | tips, 27 | mapping = ggplot2::aes(sex, total_bill, color = sex) 28 | )) 29 | } 30 | \author{ 31 | Barret Schloerke 32 | } 33 | \keyword{hplot} 34 | -------------------------------------------------------------------------------- /man/lowertriangle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggscatmat.R 3 | \name{lowertriangle} 4 | \alias{lowertriangle} 5 | \title{lowertriangle - rearrange dataset as the preparation of \code{\link{ggscatmat}} function} 6 | \usage{ 7 | lowertriangle(data, columns = 1:ncol(data), color = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{a data matrix. Should contain numerical (continuous) data.} 11 | 12 | \item{columns}{an option to choose the column to be used in the raw dataset. Defaults to \code{1:ncol(data)}} 13 | 14 | \item{color}{an option to choose a factor variable to be grouped with. Defaults to \code{(NULL)}} 15 | } 16 | \description{ 17 | function for making the melted dataset used to plot the lowertriangle scatterplots. 18 | } 19 | \examples{ 20 | data(flea) 21 | head(lowertriangle(flea, columns = 2:4)) 22 | head(lowertriangle(flea)) 23 | head(lowertriangle(flea, color = "species")) 24 | } 25 | \author{ 26 | Mengjia Ni, Di Cook 27 | } 28 | -------------------------------------------------------------------------------- /R/data-nasa.R: -------------------------------------------------------------------------------- 1 | #' Data from the Data Expo JSM 2006. 2 | #' 3 | #' This data was provided by NASA for the competition. 4 | #' 5 | #' The data shows 6 years of monthly measurements of a 24x24 spatial grid 6 | #' from Central America: 7 | #' 8 | #' @details \itemize{ 9 | #' \item time integer specifying temporal order of measurements 10 | #' \item x, y, lat, long spatial location of measurements. 11 | #' \item cloudhigh, cloudlow, cloudmid, ozone, pressure, surftemp, temperature 12 | #' are the various satellite measurements. 13 | #' \item date, day, month, year specifying the time of measurements. 14 | #' \item id unique ide for each spatial position. 15 | #' } 16 | #' 17 | #' @docType data 18 | #' @keywords datasets 19 | #' @name nasa 20 | #' @usage data(nasa) 21 | #' @format A data frame with 41472 rows and 17 variables 22 | #' @references 23 | #' Murrell, P. (2010) The 2006 Data Expo of the American Statistical Association. 24 | #' Computational Statistics, 25:551-554. 25 | NULL 26 | -------------------------------------------------------------------------------- /man/ggally_barDiag.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_barDiag} 4 | \alias{ggally_barDiag} 5 | \title{Bar plot} 6 | \usage{ 7 | ggally_barDiag(data, mapping, ..., rescale = FALSE) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{other arguments are sent to geom_bar} 15 | 16 | \item{rescale}{boolean to decide whether or not to rescale the count output. Only applies to numeric data} 17 | } 18 | \description{ 19 | Displays a bar plot for the diagonal of a \code{\link{ggpairs}} plot matrix. 20 | } 21 | \examples{ 22 | # Small function to display plots only if it's interactive 23 | p_ <- GGally::print_if_interactive 24 | 25 | data(tips) 26 | p_(ggally_barDiag(tips, mapping = ggplot2::aes(x = day))) 27 | p_(ggally_barDiag(tips, mapping = ggplot2::aes(x = tip), binwidth = 0.25)) 28 | } 29 | \author{ 30 | Barret Schloerke 31 | } 32 | \keyword{hplot} 33 | -------------------------------------------------------------------------------- /man/model_terms.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{model_response_variables} 4 | \alias{model_response_variables} 5 | \alias{model_beta_variables} 6 | \alias{model_beta_label} 7 | \title{Model term names} 8 | \usage{ 9 | model_response_variables(model, data = broom::augment(model)) 10 | 11 | model_beta_variables(model, data = broom::augment(model)) 12 | 13 | model_beta_label(model, data = broom::augment(model), lmStars = TRUE) 14 | } 15 | \arguments{ 16 | \item{model}{model in question} 17 | 18 | \item{data}{equivalent to \code{broom::augment(model)}} 19 | 20 | \item{lmStars}{boolean that determines if stars are added to labels} 21 | } 22 | \value{ 23 | character vector of names 24 | } 25 | \description{ 26 | Retrieve either the response variable names, the beta variable names, or beta variable names. If the model is an object of class 'lm', by default, the beta variable names will include anova significance stars. 27 | } 28 | -------------------------------------------------------------------------------- /man/ggally_points.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_points} 4 | \alias{ggally_points} 5 | \title{Scatter plot} 6 | \usage{ 7 | ggally_points(data, mapping, ...) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{other arguments are sent to geom_point} 15 | } 16 | \description{ 17 | Make a scatter plot with a given data set. 18 | } 19 | \examples{ 20 | # Small function to display plots only if it's interactive 21 | p_ <- GGally::print_if_interactive 22 | 23 | data(mtcars) 24 | p_(ggally_points(mtcars, mapping = ggplot2::aes(disp, hp))) 25 | p_(ggally_points(mtcars, mapping = ggplot2::aes(disp, hp))) 26 | p_(ggally_points( 27 | mtcars, 28 | mapping = ggplot2::aes( 29 | x = disp, 30 | y = hp, 31 | color = as.factor(cyl), 32 | size = gear 33 | ) 34 | )) 35 | } 36 | \author{ 37 | Barret Schloerke 38 | } 39 | \keyword{hplot} 40 | -------------------------------------------------------------------------------- /man/ggally_densityDiag.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_densityDiag} 4 | \alias{ggally_densityDiag} 5 | \title{Univariate density plot} 6 | \usage{ 7 | ggally_densityDiag(data, mapping, ..., rescale = FALSE) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used.} 13 | 14 | \item{...}{other arguments sent to stat_density} 15 | 16 | \item{rescale}{boolean to decide whether or not to rescale the count output} 17 | } 18 | \description{ 19 | Displays a density plot for the diagonal of a \code{\link{ggpairs}} plot matrix. 20 | } 21 | \examples{ 22 | # Small function to display plots only if it's interactive 23 | p_ <- GGally::print_if_interactive 24 | 25 | data(tips) 26 | p_(ggally_densityDiag(tips, mapping = ggplot2::aes(x = total_bill))) 27 | p_(ggally_densityDiag(tips, mapping = ggplot2::aes(x = total_bill, color = day))) 28 | } 29 | \author{ 30 | Barret Schloerke 31 | } 32 | \keyword{hplot} 33 | -------------------------------------------------------------------------------- /man/twitter_spambots.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-twitter_spambots.R 3 | \docType{data} 4 | \name{twitter_spambots} 5 | \alias{twitter_spambots} 6 | \title{Twitter spambots} 7 | \format{ 8 | An object of class \code{network} with 120 edges and 94 vertices. 9 | } 10 | \usage{ 11 | data(twitter_spambots) 12 | } 13 | \description{ 14 | A network of spambots found on Twitter as part of a data mining project. 15 | } 16 | \details{ 17 | Each node of the network is identified by the Twitter screen name of the 18 | account and further carries five vertex attributes: 19 | 20 | \itemize{ 21 | \item location user's location, as provided by the user 22 | \item lat latitude, based on the user's location 23 | \item lon longitude, based on the user's location 24 | \item followers number of Twitter accounts that follow this account 25 | \item friends number of Twitter accounts followed by the account 26 | } 27 | } 28 | \author{ 29 | Amos Elberg 30 | } 31 | \keyword{datasets} 32 | -------------------------------------------------------------------------------- /R/data-psychademic.R: -------------------------------------------------------------------------------- 1 | #' UCLA canonical correlation analysis data 2 | #' 3 | #' This data contains 600 observations on eight variables 4 | #' 5 | #' @details \itemize{ 6 | #' \item locus_of_control - psychological 7 | #' \item self_concept - psychological 8 | #' \item motivation - psychological. Converted to four character groups 9 | #' \item read - academic 10 | #' \item write - academic 11 | #' \item math - academic 12 | #' \item science - academic 13 | #' \item female - academic. Dropped from original source 14 | #' \item sex - academic. Added as a character version of female column 15 | #' } 16 | #' 17 | #' @docType data 18 | #' @keywords datasets 19 | #' @name psychademic 20 | #' @usage data(psychademic) 21 | #' @format A data frame with 600 rows and 8 variables 22 | #' @references 23 | #' R Data Analysis Examples | Canonical Correlation Analysis. UCLA: Institute for Digital Research and Education. from http://www.stats.idre.ucla.edu/r/dae/canonical-correlation-analysis (accessed May 22, 2017). 24 | NULL 25 | -------------------------------------------------------------------------------- /R/data-flea.R: -------------------------------------------------------------------------------- 1 | #' Historical data used for classification examples. 2 | #' 3 | #' This data contains physical measurements on three species of flea beetles. 4 | #' 5 | #' @details \itemize{ 6 | #' \item species Ch. concinna, Ch. heptapotamica, Ch. heikertingeri 7 | #' \item tars1 width of the first joint of the first tarsus in microns 8 | #' \item tars2 width of the second joint of the first tarsus in microns 9 | #' \item head the maximal width of the head between the external edges of the eyes in 0.01 mm 10 | #' \item aede1 the maximal width of the aedeagus in the fore-part in microns 11 | #' \item aede2 the front angle of the aedeagus (1 unit = 7.5 degrees) 12 | #' \item aede3 the aedeagus width from the side in microns 13 | #' } 14 | #' 15 | #' @docType data 16 | #' @keywords datasets 17 | #' @name flea 18 | #' @usage data(flea) 19 | #' @format A data frame with 74 rows and 7 variables 20 | #' @references 21 | #' Lubischew, A. A. (1962), On the Use of Discriminant Functions in 22 | #' Taxonomy, Biometrics 18:455-477. 23 | NULL 24 | -------------------------------------------------------------------------------- /man/broomify.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{broomify} 4 | \alias{broomify} 5 | \title{Broomify a model} 6 | \usage{ 7 | broomify(model, lmStars = TRUE) 8 | } 9 | \arguments{ 10 | \item{model}{model to be sent to \code{\link[broom:reexports]{broom::augment()}}, \code{\link[broom:reexports]{broom::glance()}}, and \code{\link[broom:reexports]{broom::tidy()}}} 11 | 12 | \item{lmStars}{boolean that determines if stars are added to labels} 13 | } 14 | \value{ 15 | broom::augmented data frame with the broom::glance data.frame and broom::tidy data.frame as 'broom_glance' and 'broom_tidy' attributes respectively. \code{var_x} and \code{var_y} variables are also added as attributes 16 | } 17 | \description{ 18 | broom::augment a model and add broom::glance and broom::tidy output as attributes. X and Y variables are also added. 19 | } 20 | \examples{ 21 | data(mtcars) 22 | model <- stats::lm(mpg ~ wt + qsec + am, data = mtcars) 23 | broomified_model <- broomify(model) 24 | str(broomified_model) 25 | } 26 | -------------------------------------------------------------------------------- /man/tips.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-tips.R 3 | \docType{data} 4 | \name{tips} 5 | \alias{tips} 6 | \title{Tipping data} 7 | \format{ 8 | A data frame with 244 rows and 7 variables 9 | } 10 | \usage{ 11 | tips 12 | } 13 | \description{ 14 | One waiter recorded information about each tip he received over a 15 | period of a few months working in one restaurant. He collected several 16 | variables: 17 | } 18 | \details{ 19 | \itemize{ 20 | \item tip in dollars, 21 | \item bill in dollars, 22 | \item sex of the bill payer, 23 | \item whether there were smokers in the party, 24 | \item day of the week, 25 | \item time of day, 26 | \item size of the party. 27 | } 28 | 29 | In all he recorded 244 tips. The data was reported in a collection of 30 | case studies for business statistics (Bryant & Smith 1995). 31 | } 32 | \references{ 33 | Bryant, P. G. and Smith, M (1995) \emph{Practical Data 34 | Analysis: Case Studies in Business Statistics}. Homewood, IL: Richard D. 35 | Irwin Publishing: 36 | } 37 | \keyword{datasets} 38 | -------------------------------------------------------------------------------- /tests/testthat/test-crosstalk.R: -------------------------------------------------------------------------------- 1 | test_that("crosstalk works with ggduo and ggpairs", { 2 | skip_if_not_installed("crosstalk") 3 | 4 | sd <- try(crosstalk::SharedData$new(iris[1:4]), silent = TRUE) 5 | if (inherits(sd, "try-error")) { 6 | skip("crosstalk data can not be initialized") 7 | } 8 | 9 | expect_silent({ 10 | pm <- ggpairs(sd) 11 | }) 12 | expect_snapshot(ggpairs(sd, 3:5), error = TRUE) 13 | expect_snapshot( 14 | ggpairs(sd, c("Petal.Length", "Petal.Width", crosstalk_key())), 15 | error = TRUE 16 | ) 17 | 18 | expect_silent({ 19 | pm <- ggduo(sd) 20 | }) 21 | expect_snapshot(ggduo(sd, c(1:2, 5), 3:5), error = TRUE) 22 | expect_snapshot( 23 | ggduo( 24 | sd, 25 | c("Sepal.Length", "Sepal.Width", crosstalk_key()), 26 | c("Petal.Length", "Petal.Width") 27 | ), 28 | error = TRUE 29 | ) 30 | expect_snapshot( 31 | ggduo( 32 | sd, 33 | c("Sepal.Length", "Sepal.Width"), 34 | c("Petal.Length", "Petal.Width", crosstalk_key()) 35 | ), 36 | error = TRUE 37 | ) 38 | }) 39 | -------------------------------------------------------------------------------- /man/nasa.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-nasa.R 3 | \docType{data} 4 | \name{nasa} 5 | \alias{nasa} 6 | \title{Data from the Data Expo JSM 2006.} 7 | \format{ 8 | A data frame with 41472 rows and 17 variables 9 | } 10 | \usage{ 11 | data(nasa) 12 | } 13 | \description{ 14 | This data was provided by NASA for the competition. 15 | } 16 | \details{ 17 | The data shows 6 years of monthly measurements of a 24x24 spatial grid 18 | from Central America: 19 | 20 | \itemize{ 21 | \item time integer specifying temporal order of measurements 22 | \item x, y, lat, long spatial location of measurements. 23 | \item cloudhigh, cloudlow, cloudmid, ozone, pressure, surftemp, temperature 24 | are the various satellite measurements. 25 | \item date, day, month, year specifying the time of measurements. 26 | \item id unique ide for each spatial position. 27 | } 28 | } 29 | \references{ 30 | Murrell, P. (2010) The 2006 Data Expo of the American Statistical Association. 31 | Computational Statistics, 25:551-554. 32 | } 33 | \keyword{datasets} 34 | -------------------------------------------------------------------------------- /man/singleClassOrder.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggparcoord.R 3 | \name{singleClassOrder} 4 | \alias{singleClassOrder} 5 | \title{Order axis variables} 6 | \usage{ 7 | singleClassOrder(classVar, axisVars, specClass = NULL) 8 | } 9 | \arguments{ 10 | \item{classVar}{class variable (vector from original dataset)} 11 | 12 | \item{axisVars}{variables to be plotted as axes (data frame)} 13 | 14 | \item{specClass}{character string matching to level of \code{classVar}; instead 15 | of looking for separation between any class and the rest, will only look for 16 | separation between this class and the rest} 17 | } 18 | \value{ 19 | character vector of names of axisVars ordered such that the first 20 | variable has the most separation between one of the classes and the rest, and 21 | the last variable has the least (as measured by F-statistics from an ANOVA) 22 | } 23 | \description{ 24 | Order axis variables by separation between one class and the rest 25 | (most separation to least). 26 | } 27 | \author{ 28 | Jason Crowley 29 | } 30 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/ggnetworkmap.md: -------------------------------------------------------------------------------- 1 | # labels 2 | 3 | Code 4 | ggnetworkmap(usa, flights, label.nodes = c("A", "B")) 5 | Condition 6 | Error in `ggnetworkmap()`: 7 | ! length(labels) == nrow(plotcord) is not TRUE 8 | 9 | # arrow.size 10 | 11 | Code 12 | ggnetworkmap(net = flights, arrow.size = -1) 13 | Condition 14 | Error in `ggnetworkmap()`: 15 | ! incorrect `arrow.size` value 16 | 17 | # network coercion 18 | 19 | Code 20 | ggnetworkmap(net = 1:2) 21 | Condition 22 | Error in `ggnetworkmap()`: 23 | ! could not coerce `net` to a network object 24 | 25 | --- 26 | 27 | Code 28 | ggnetworkmap(net = network(data.frame(1:2, 3:4), hyper = TRUE)) 29 | Condition 30 | Error: 31 | ! If `hyper` is `TRUE`, the first two columns of `x` should be list columns. 32 | 33 | --- 34 | 35 | Code 36 | ggnetworkmap(net = network(data.frame(1:2, 3:4), multiple = TRUE)) 37 | Condition 38 | Error in `ggnetworkmap()`: 39 | ! `ggnetworkmap()` cannot plot multiplex graphs 40 | 41 | -------------------------------------------------------------------------------- /man/uppertriangle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggscatmat.R 3 | \name{uppertriangle} 4 | \alias{uppertriangle} 5 | \title{Rearrange dataset as the preparation of \code{\link{ggscatmat}} function} 6 | \usage{ 7 | uppertriangle( 8 | data, 9 | columns = 1:ncol(data), 10 | color = NULL, 11 | corMethod = "pearson" 12 | ) 13 | } 14 | \arguments{ 15 | \item{data}{a data matrix. Should contain numerical (continuous) data.} 16 | 17 | \item{columns}{an option to choose the column to be used in the raw dataset. Defaults to \code{1:ncol(data)}} 18 | 19 | \item{color}{an option to choose a factor variable to be grouped with. Defaults to \code{(NULL)}} 20 | 21 | \item{corMethod}{method argument supplied to \code{\link[stats]{cor}}} 22 | } 23 | \description{ 24 | Function for making the dataset used to plot the uppertriangle plots. 25 | } 26 | \examples{ 27 | data(flea) 28 | head(uppertriangle(flea, columns = 2:4)) 29 | head(uppertriangle(flea)) 30 | head(uppertriangle(flea, color = "species")) 31 | } 32 | \author{ 33 | Mengjia Ni, Di Cook 34 | } 35 | -------------------------------------------------------------------------------- /man/ggmatrix_gtable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggmatrix_gtable.R 3 | \name{ggmatrix_gtable} 4 | \alias{ggmatrix_gtable} 5 | \title{\code{\link{ggmatrix}} \pkg{gtable} object} 6 | \usage{ 7 | ggmatrix_gtable( 8 | pm, 9 | ..., 10 | progress = NULL, 11 | progress_format = formals(ggmatrix_progress)$format 12 | ) 13 | } 14 | \arguments{ 15 | \item{pm}{\code{\link{ggmatrix}} object to be plotted} 16 | 17 | \item{...}{ignored} 18 | 19 | \item{progress, progress_format}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use the 'progress' parameter in your \code{\link{ggmatrix}}-like function. See \code{\link{ggmatrix_progress}} for a few examples.} 20 | } 21 | \description{ 22 | Specialized method to print the \code{\link{ggmatrix}} object. 23 | } 24 | \examples{ 25 | data(tips) 26 | pm <- ggpairs(tips, c(1, 3, 2), mapping = ggplot2::aes(color = sex)) 27 | ggmatrix_gtable(pm) 28 | } 29 | \author{ 30 | Barret Schloerke 31 | } 32 | -------------------------------------------------------------------------------- /man/ggmatrix_progress.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggmatrix_progress.R 3 | \name{ggmatrix_progress} 4 | \alias{ggmatrix_progress} 5 | \title{\code{\link{ggmatrix}} default progress bar} 6 | \usage{ 7 | ggmatrix_progress( 8 | format = " plot: [:plot_i, :plot_j] [:bar]:percent est::eta ", 9 | clear = TRUE, 10 | show_after = 0, 11 | ... 12 | ) 13 | } 14 | \arguments{ 15 | \item{format, clear, show_after, ...}{parameters supplied directly to \code{progress::\link[progress]{progress_bar}$new()}} 16 | } 17 | \value{ 18 | function that accepts a plot matrix as the first argument and \code{...} for future expansion. Internally, the plot matrix is used to determine the total number of plots for the progress bar. 19 | } 20 | \description{ 21 | \code{\link{ggmatrix}} default progress bar 22 | } 23 | \examples{ 24 | p_ <- GGally::print_if_interactive 25 | 26 | pm <- ggpairs(iris, 1:2, progress = ggmatrix_progress()) 27 | p_(pm) 28 | 29 | # does not clear after finishing 30 | pm <- ggpairs(iris, 1:2, progress = ggmatrix_progress(clear = FALSE)) 31 | p_(pm) 32 | } 33 | -------------------------------------------------------------------------------- /man/ggally_dot_and_box.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_dot_and_box} 4 | \alias{ggally_dot_and_box} 5 | \title{Box and dot plot} 6 | \usage{ 7 | ggally_dot_and_box(data, mapping, ..., boxPlot = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{parameters passed to either geom_jitter or geom_boxplot} 15 | 16 | \item{boxPlot}{boolean to decide to plot either box plots (TRUE) or dot plots (FALSE)} 17 | } 18 | \description{ 19 | Place box plots or dot plots on the graph 20 | } 21 | \examples{ 22 | # Small function to display plots only if it's interactive 23 | p_ <- GGally::print_if_interactive 24 | 25 | data(tips) 26 | p_(ggally_dot_and_box( 27 | tips, 28 | mapping = ggplot2::aes(x = total_bill, y = sex, color = sex), 29 | boxPlot = TRUE 30 | )) 31 | p_(ggally_dot_and_box( 32 | tips, 33 | mapping = ggplot2::aes(x = total_bill, y = sex, color = sex), 34 | boxPlot = FALSE 35 | )) 36 | } 37 | \author{ 38 | Barret Schloerke 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/ggally_box.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_box} 4 | \alias{ggally_box} 5 | \alias{ggally_box_no_facet} 6 | \title{Box plot} 7 | \usage{ 8 | ggally_box(data, mapping, ...) 9 | 10 | ggally_box_no_facet(data, mapping, ...) 11 | } 12 | \arguments{ 13 | \item{data}{data set using} 14 | 15 | \item{mapping}{aesthetics being used} 16 | 17 | \item{...}{other arguments being supplied to geom_boxplot} 18 | } 19 | \description{ 20 | Make a box plot with a given data set. \code{ggally_box_no_facet} will be a single panel plot, while \code{ggally_box} will be a faceted plot 21 | } 22 | \examples{ 23 | # Small function to display plots only if it's interactive 24 | p_ <- GGally::print_if_interactive 25 | 26 | data(tips) 27 | p_(ggally_box(tips, mapping = ggplot2::aes(x = total_bill, y = sex))) 28 | p_(ggally_box( 29 | tips, 30 | mapping = ggplot2::aes(sex, total_bill, color = sex), 31 | outlier.colour = "red", 32 | outlier.shape = 13, 33 | outlier.size = 8 34 | )) 35 | } 36 | \author{ 37 | Barret Schloerke 38 | } 39 | \keyword{hplot} 40 | -------------------------------------------------------------------------------- /man/psychademic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-psychademic.R 3 | \docType{data} 4 | \name{psychademic} 5 | \alias{psychademic} 6 | \title{UCLA canonical correlation analysis data} 7 | \format{ 8 | A data frame with 600 rows and 8 variables 9 | } 10 | \usage{ 11 | data(psychademic) 12 | } 13 | \description{ 14 | This data contains 600 observations on eight variables 15 | } 16 | \details{ 17 | \itemize{ 18 | \item locus_of_control - psychological 19 | \item self_concept - psychological 20 | \item motivation - psychological. Converted to four character groups 21 | \item read - academic 22 | \item write - academic 23 | \item math - academic 24 | \item science - academic 25 | \item female - academic. Dropped from original source 26 | \item sex - academic. Added as a character version of female column 27 | } 28 | } 29 | \references{ 30 | R Data Analysis Examples | Canonical Correlation Analysis. UCLA: Institute for Digital Research and Education. from http://www.stats.idre.ucla.edu/r/dae/canonical-correlation-analysis (accessed May 22, 2017). 31 | } 32 | \keyword{datasets} 33 | -------------------------------------------------------------------------------- /man/flea.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-flea.R 3 | \docType{data} 4 | \name{flea} 5 | \alias{flea} 6 | \title{Historical data used for classification examples.} 7 | \format{ 8 | A data frame with 74 rows and 7 variables 9 | } 10 | \usage{ 11 | data(flea) 12 | } 13 | \description{ 14 | This data contains physical measurements on three species of flea beetles. 15 | } 16 | \details{ 17 | \itemize{ 18 | \item species Ch. concinna, Ch. heptapotamica, Ch. heikertingeri 19 | \item tars1 width of the first joint of the first tarsus in microns 20 | \item tars2 width of the second joint of the first tarsus in microns 21 | \item head the maximal width of the head between the external edges of the eyes in 0.01 mm 22 | \item aede1 the maximal width of the aedeagus in the fore-part in microns 23 | \item aede2 the front angle of the aedeagus (1 unit = 7.5 degrees) 24 | \item aede3 the aedeagus width from the side in microns 25 | } 26 | } 27 | \references{ 28 | Lubischew, A. A. (1962), On the Use of Discriminant Functions in 29 | Taxonomy, Biometrics 18:455-477. 30 | } 31 | \keyword{datasets} 32 | -------------------------------------------------------------------------------- /man/ggally_nostic_std_resid.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{ggally_nostic_std_resid} 4 | \alias{ggally_nostic_std_resid} 5 | \title{\code{\link{ggnostic}} standardized residuals} 6 | \usage{ 7 | ggally_nostic_std_resid(data, mapping, ..., sigma = 1) 8 | } 9 | \arguments{ 10 | \item{data, mapping, ...}{parameters supplied to \code{\link{ggally_nostic_resid}}} 11 | 12 | \item{sigma}{sigma value for the \code{pVal} percentiles. Set to 1 for standardized residuals} 13 | } 14 | \value{ 15 | \pkg{ggplot2} plot object 16 | } 17 | \description{ 18 | If non-null \code{pVal} and \code{sigma} values are given, confidence interval lines will be added to the plot at the specified \code{pVal} locations of a N(0, 1) distribution. 19 | } 20 | \examples{ 21 | # Small function to display plots only if it's interactive 22 | p_ <- GGally::print_if_interactive 23 | 24 | dt <- broomify(stats::lm(mpg ~ wt + qsec + am, data = mtcars)) 25 | p_(ggally_nostic_std_resid(dt, ggplot2::aes(wt, .std.resid))) 26 | } 27 | \seealso{ 28 | \code{\link[stats:influence.measures]{stats::rstandard()}} 29 | } 30 | -------------------------------------------------------------------------------- /man/scatmat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggscatmat.R 3 | \name{scatmat} 4 | \alias{scatmat} 5 | \title{Plots the lowertriangle and density plots of the scatter plot matrix.} 6 | \usage{ 7 | scatmat(data, columns = 1:ncol(data), color = NULL, alpha = 1) 8 | } 9 | \arguments{ 10 | \item{data}{a data matrix. Should contain numerical (continuous) data.} 11 | 12 | \item{columns}{an option to choose the column to be used in the raw dataset. Defaults to \code{1:ncol(data)}} 13 | 14 | \item{color}{an option to group the dataset by the factor variable and color them by different colors. Defaults to \code{NULL}} 15 | 16 | \item{alpha}{an option to set the transparency in scatterplots for large data. Defaults to \code{1}.} 17 | } 18 | \description{ 19 | Function for making scatterplots in the lower triangle and diagonal density plots. 20 | } 21 | \examples{ 22 | # small function to display plots only if it's interactive 23 | p_ <- GGally::print_if_interactive 24 | 25 | data(flea) 26 | 27 | p_(scatmat(flea, columns = 2:4)) 28 | p_(scatmat(flea, columns = 2:4, color = "species")) 29 | } 30 | \author{ 31 | Mengjia Ni, Di Cook 32 | } 33 | -------------------------------------------------------------------------------- /tests/testthat/test-ggscatmat.R: -------------------------------------------------------------------------------- 1 | data(flea) 2 | 3 | test_that("example", { 4 | flea2 <- flea 5 | flea2$species2 <- as.character(flea2$species) 6 | expect_warning( 7 | p <- ggscatmat(flea2, c(1:3)), 8 | "Factor variables are omitted in plot" 9 | ) 10 | expect_warning( 11 | p <- ggscatmat(flea2, c(2:3, 8)), 12 | "Factor variables are omitted in plot" 13 | ) 14 | expect_true(is.null(get_labs(p)$colour)) 15 | ggally_expect_doppelganger("flea", p) 16 | 17 | p <- ggscatmat(flea, columns = 2:4, color = "species") 18 | expect_true(!is.null(get_labs(p)$colour)) 19 | ggally_expect_doppelganger("flea-color", p) 20 | }) 21 | 22 | test_that("corMethod", { 23 | p <- ggscatmat(flea, columns = 2:3, corMethod = "pearson") 24 | ggally_expect_doppelganger("flea-pearson", p) 25 | p <- ggscatmat(flea, columns = 2:3, corMethod = "rsquare") 26 | ggally_expect_doppelganger("flea-rsquare", p) 27 | }) 28 | 29 | test_that("stops", { 30 | expect_snapshot(ggscatmat(flea, columns = c(1, 2)), error = TRUE) 31 | expect_snapshot(ggscatmat(flea, columns = c(1, 1, 1)), error = TRUE) 32 | expect_snapshot(scatmat(flea, columns = c(1, 1, 1)), error = TRUE) 33 | }) 34 | -------------------------------------------------------------------------------- /man/ggally_dot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_dot} 4 | \alias{ggally_dot} 5 | \alias{ggally_dot_no_facet} 6 | \title{Grouped dot plot} 7 | \usage{ 8 | ggally_dot(data, mapping, ...) 9 | 10 | ggally_dot_no_facet(data, mapping, ...) 11 | } 12 | \arguments{ 13 | \item{data}{data set using} 14 | 15 | \item{mapping}{aesthetics being used} 16 | 17 | \item{...}{other arguments being supplied to geom_jitter} 18 | } 19 | \description{ 20 | Add jittering with the box plot. \code{ggally_dot_no_facet} will be a single panel plot, while \code{ggally_dot} will be a faceted plot 21 | } 22 | \examples{ 23 | # Small function to display plots only if it's interactive 24 | p_ <- GGally::print_if_interactive 25 | 26 | data(tips) 27 | p_(ggally_dot(tips, mapping = ggplot2::aes(x = total_bill, y = sex))) 28 | p_(ggally_dot( 29 | tips, 30 | mapping = ggplot2::aes(sex, total_bill, color = sex) 31 | )) 32 | p_(ggally_dot( 33 | tips, 34 | mapping = ggplot2::aes(sex, total_bill, color = sex, shape = sex) 35 | ) + ggplot2::scale_shape(solid = FALSE)) 36 | } 37 | \author{ 38 | Barret Schloerke 39 | } 40 | \keyword{hplot} 41 | -------------------------------------------------------------------------------- /R/reexports.R: -------------------------------------------------------------------------------- 1 | # reexports from ggstats ------------------- 2 | 3 | #' @importFrom ggstats ggcoef_model 4 | #' @export 5 | ggstats::ggcoef_model 6 | 7 | #' @importFrom ggstats ggcoef_compare 8 | #' @export 9 | ggstats::ggcoef_compare 10 | 11 | #' @importFrom ggstats ggcoef_multinom 12 | #' @export 13 | ggstats::ggcoef_multinom 14 | 15 | #' @importFrom ggstats ggcoef_plot 16 | #' @export 17 | ggstats::ggcoef_plot 18 | 19 | #' @importFrom ggstats signif_stars 20 | #' @export 21 | ggstats::signif_stars 22 | 23 | #' @importFrom ggstats geom_stripped_cols 24 | #' @export 25 | ggstats::geom_stripped_cols 26 | 27 | #' @importFrom ggstats geom_stripped_rows 28 | #' @export 29 | ggstats::geom_stripped_rows 30 | 31 | #' @importFrom ggstats stat_cross 32 | #' @export 33 | ggstats::stat_cross 34 | 35 | #' @importFrom ggstats StatCross 36 | #' @export 37 | ggstats::StatCross 38 | 39 | #' @importFrom ggstats stat_prop 40 | #' @export 41 | ggstats::stat_prop 42 | 43 | #' @importFrom ggstats StatProp 44 | #' @export 45 | ggstats::StatProp 46 | 47 | #' @importFrom ggstats stat_weighted_mean 48 | #' @export 49 | ggstats::stat_weighted_mean 50 | 51 | #' @importFrom ggstats StatWeightedMean 52 | #' @export 53 | ggstats::StatWeightedMean 54 | -------------------------------------------------------------------------------- /R/data-pigs.R: -------------------------------------------------------------------------------- 1 | #' United Kingdom Pig Production 2 | #' 3 | #' This data contains about the United Kingdom Pig Production from the book 'Data' by Andrews and Herzberg. The original data can be on Statlib: http://lib.stat.cmu.edu/datasets/Andrews/T62.1 4 | #' 5 | #' The time variable has been added from a combination of year and quarter 6 | #' 7 | #' @details \itemize{ 8 | #' \item time year + (quarter - 1) / 4 9 | #' \item year year of production 10 | #' \item quarter quarter of the year of production 11 | #' \item gilts number of sows giving birth for the first time 12 | #' \item profit ratio of price to an index of feed price 13 | #' \item s_per_herdsz ratio of the number of breeding pigs slaughtered to the total breeding herd size 14 | #' \item production number of pigs slaughtered that were reared for meat 15 | #' \item herdsz breeding herd size 16 | #' } 17 | #' 18 | #' @docType data 19 | #' @keywords datasets 20 | #' @name pigs 21 | #' @usage data(pigs) 22 | #' @format A data frame with 48 rows and 8 variables 23 | #' @references 24 | #' Andrews, David F., and Agnes M. Herzberg. Data: a collection of problems from many fields for the student and research worker. Springer Science & Business Media, 2012. 25 | NULL 26 | -------------------------------------------------------------------------------- /man/ggally_density.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_density} 4 | \alias{ggally_density} 5 | \title{Bivariate density plot} 6 | \usage{ 7 | ggally_density(data, mapping, ...) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{parameters sent to either stat_density2d or geom_density2d} 15 | } 16 | \description{ 17 | Make a 2D density plot from a given data. 18 | } 19 | \details{ 20 | The aesthetic "fill" determines whether or not \code{stat_density2d} (filled) or \code{geom_density2d} (lines) is used. 21 | } 22 | \examples{ 23 | # Small function to display plots only if it's interactive 24 | p_ <- GGally::print_if_interactive 25 | 26 | data(tips) 27 | p_(ggally_density(tips, mapping = ggplot2::aes(x = total_bill, y = tip))) 28 | p_(ggally_density( 29 | tips, 30 | mapping = ggplot2::aes(total_bill, tip, fill = after_stat(level)) 31 | )) 32 | p_(ggally_density( 33 | tips, 34 | mapping = ggplot2::aes(total_bill, tip, fill = after_stat(level)) 35 | ) + ggplot2::scale_fill_gradient(breaks = c(0.05, 0.1, 0.15, 0.2))) 36 | } 37 | \author{ 38 | Barret Schloerke 39 | } 40 | \keyword{hplot} 41 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/ggsurv.md: -------------------------------------------------------------------------------- 1 | # stops 2 | 3 | Code 4 | ggsurv(lungNoCensor, surv.col = c("black", "red")) 5 | Condition 6 | Error in `ggsurv()`: 7 | ! length(surv.col) == 1 | length(surv.col) == strata is not TRUE 8 | 9 | --- 10 | 11 | Code 12 | ggsurv(lungNoCensor, lty.est = 1:2) 13 | Condition 14 | Error in `ggsurv()`: 15 | ! length(lty.est) == 1 | length(lty.est) == strata is not TRUE 16 | 17 | --- 18 | 19 | Code 20 | ggsurv(lungNoCensor, plot.cens = TRUE) 21 | Condition 22 | Error in `fn()`: 23 | ! There are no censored observations 24 | 25 | --- 26 | 27 | Code 28 | ggsurv(kidneyNoCensor, surv.col = c("black", "red", "blue")) 29 | Condition 30 | Error in `ggsurv()`: 31 | ! length(surv.col) == 1 | length(surv.col) == strata is not TRUE 32 | 33 | --- 34 | 35 | Code 36 | ggsurv(kidneyNoCensor, lty.est = 1:3) 37 | Condition 38 | Error in `ggsurv()`: 39 | ! length(lty.est) == 1 | length(lty.est) == strata is not TRUE 40 | 41 | --- 42 | 43 | Code 44 | ggsurv(kidneyNoCensor, plot.cens = TRUE) 45 | Condition 46 | Error in `fn()`: 47 | ! There are no censored observations 48 | 49 | -------------------------------------------------------------------------------- /man/ggally_text.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_text} 4 | \alias{ggally_text} 5 | \title{Text plot} 6 | \usage{ 7 | ggally_text( 8 | label, 9 | mapping = ggplot2::aes(color = I("black")), 10 | xP = 0.5, 11 | yP = 0.5, 12 | xrange = c(0, 1), 13 | yrange = c(0, 1), 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{label}{text that you want to appear} 19 | 20 | \item{mapping}{aesthetics that don't relate to position (such as color)} 21 | 22 | \item{xP}{horizontal position percentage} 23 | 24 | \item{yP}{vertical position percentage} 25 | 26 | \item{xrange}{range of the data around it. Only nice to have if plotting in a matrix} 27 | 28 | \item{yrange}{range of the data around it. Only nice to have if plotting in a matrix} 29 | 30 | \item{...}{other arguments for geom_text} 31 | } 32 | \description{ 33 | Plot text for a plot. 34 | } 35 | \examples{ 36 | # Small function to display plots only if it's interactive 37 | p_ <- GGally::print_if_interactive 38 | 39 | p_(ggally_text("Example 1")) 40 | p_(ggally_text("Example\nTwo", mapping = ggplot2::aes(size = 15), color = I("red"))) 41 | } 42 | \author{ 43 | Barret Schloerke 44 | } 45 | \keyword{hplot} 46 | -------------------------------------------------------------------------------- /scripts/psychademic.R: -------------------------------------------------------------------------------- 1 | psychademic <- read.csv("http://stats.idre.ucla.edu/stat/data/mmreg.csv") 2 | 3 | str(psychademic) 4 | # 'data.frame': 600 obs. of 8 variables: 5 | # $ locus_of_control: num -0.84 -0.38 0.89 0.71 -0.64 1.11 0.06 -0.91 0.45 0 ... 6 | # $ self_concept : num -0.24 -0.47 0.59 0.28 0.03 0.9 0.03 -0.59 0.03 0.03 ... 7 | # $ motivation : num 1 0.67 0.67 0.67 1 0.33 0.67 0.67 1 0.67 ... 8 | # $ read : num 54.8 62.7 60.6 62.7 41.6 62.7 41.6 44.2 62.7 62.7 ... 9 | # $ write : num 64.5 43.7 56.7 56.7 46.3 64.5 39.1 39.1 51.5 64.5 ... 10 | # $ math : num 44.5 44.7 70.5 54.7 38.4 61.4 56.3 46.3 54.4 38.3 ... 11 | # $ science : num 52.6 52.6 58 58 36.3 58 45 36.3 49.8 55.8 ... 12 | # $ female : int 1 1 0 0 1 1 0 0 1 1 ... 13 | 14 | psychademic$motivation <- as.character(round(psychademic$motivation * 3 + 1)) 15 | 16 | psychademic$sex <- (c("male", "female"))[c(psychademic$female + 1)] 17 | psychademic$female <- NULL 18 | 19 | attr(psychademic, "academic") <- c("read", "write", "math", "science", "sex") 20 | attr(psychademic, "psychology") <- c( 21 | "locus_of_control", 22 | "self_concept", 23 | "motivation" 24 | ) 25 | 26 | 27 | devtools::use_data(psychademic, overwrite = TRUE) 28 | -------------------------------------------------------------------------------- /man/glyphplot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gglyph.R 3 | \name{glyphplot} 4 | \alias{glyphplot} 5 | \alias{is.glyphplot} 6 | \alias{[.glyphplot} 7 | \alias{print.glyphplot} 8 | \title{Glyph plot class} 9 | \usage{ 10 | glyphplot(data, width, height, polar, x_major, y_major) 11 | 12 | is.glyphplot(x) 13 | 14 | \method{[}{glyphplot}(x, ...) 15 | 16 | \method{print}{glyphplot}(x, ...) 17 | } 18 | \arguments{ 19 | \item{data}{A data frame containing variables named in \code{x_major}, 20 | \code{x_minor}, \code{y_major} and \code{y_minor}.} 21 | 22 | \item{height, width}{The height and width of each glyph. Defaults to 95\% of 23 | the \code{\link[ggplot2]{resolution}} of the data. Specify the width 24 | absolutely by supplying a numeric vector of length 1, or relative to the} 25 | 26 | \item{polar}{A logical of length 1, specifying whether the glyphs should 27 | be drawn in polar coordinates. Defaults to \code{FALSE}.} 28 | 29 | \item{x_major, y_major}{The name of the variable (as a 30 | string) for the major x and y axes. Together, the} 31 | 32 | \item{x}{glyphplot to be printed} 33 | 34 | \item{...}{ignored} 35 | } 36 | \description{ 37 | Glyph plot class 38 | } 39 | \author{ 40 | Di Cook, Heike Hofmann, Hadley Wickham 41 | } 42 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/rstudio/shiny-workflows 2 | # 3 | # NOTE: This Shiny team GHA workflow is overkill for most R packages. 4 | # For most R packages it is better to use https://github.com/r-lib/actions 5 | on: 6 | push: 7 | branches: [main, rc-**] 8 | pull_request: 9 | schedule: 10 | - cron: "0 5 * * 1" # every monday 11 | 12 | name: Package checks 13 | 14 | jobs: 15 | website: 16 | uses: rstudio/shiny-workflows/.github/workflows/website.yaml@v1 17 | routine: 18 | uses: rstudio/shiny-workflows/.github/workflows/routine.yaml@v1 19 | with: 20 | format-r-code: true 21 | R-CMD-check: 22 | uses: rstudio/shiny-workflows/.github/workflows/R-CMD-check.yaml@v1 23 | strategy: 24 | fail-fast: false 25 | matrix: 26 | config: 27 | # Regular CRAN checks 28 | - cache-version: "cran" 29 | 30 | # Test with dev ggplot2 31 | - extra-packages: | 32 | tidyverse/ggplot2 33 | cache-version: "dev-ggplot2" 34 | 35 | with: 36 | check-timeout-minutes: 60 37 | minimum-r-version: "4.3.0" 38 | extra-packages: ${{ matrix.config.extra-packages || '' }} 39 | cache-version: ${{ matrix.config.cache-version }} 40 | -------------------------------------------------------------------------------- /man/grab_legend.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggmatrix_legend.R 3 | \name{grab_legend} 4 | \alias{grab_legend} 5 | \alias{print.legend_guide_box} 6 | \title{Grab the legend and print it as a plot} 7 | \usage{ 8 | grab_legend(p) 9 | 10 | \method{print}{legend_guide_box}(x, ..., plotNew = FALSE) 11 | } 12 | \arguments{ 13 | \item{p}{ggplot2 plot object} 14 | 15 | \item{x}{legend object that has been grabbed from a ggplot2 object} 16 | 17 | \item{...}{ignored} 18 | 19 | \item{plotNew}{boolean to determine if the \code{grid.newpage()} command and a new blank rectangle should be printed} 20 | } 21 | \description{ 22 | Grab the legend and print it as a plot 23 | } 24 | \examples{ 25 | # Small function to display plots only if it's interactive 26 | p_ <- GGally::print_if_interactive 27 | 28 | library(ggplot2) 29 | histPlot <- 30 | ggplot(iris, aes(Sepal.Length, fill = Species)) + 31 | geom_histogram(binwidth = 1 / 4) 32 | (right <- histPlot) 33 | (bottom <- histPlot + theme(legend.position = "bottom")) 34 | (top <- histPlot + theme(legend.position = "top")) 35 | (left <- histPlot + theme(legend.position = "left")) 36 | 37 | p_(grab_legend(right)) 38 | p_(grab_legend(bottom)) 39 | p_(grab_legend(top)) 40 | p_(grab_legend(left)) 41 | } 42 | -------------------------------------------------------------------------------- /tests/testthat/test-wrap.R: -------------------------------------------------------------------------------- 1 | test_that("errors", { 2 | fn <- ggally_points 3 | 4 | # named params 5 | expect_snapshot(wrap(fn, NA), error = TRUE) 6 | expect_snapshot(wrap(fn, y = TRUE, 5), error = TRUE) 7 | 8 | # named params to wrapp 9 | expect_snapshot(wrapp(fn, list(5)), error = TRUE) 10 | expect_snapshot(wrapp(fn, table(1:10, 1:10)), error = TRUE) 11 | expect_snapshot(wrapp(fn, list(A = 4, 5)), error = TRUE) 12 | 13 | # if the character fn doesn't exist 14 | expect_snapshot(wrap("does not exist", A = 5), error = TRUE) 15 | expect_snapshot(wrapp("does not exist", list(A = 5)), error = TRUE) 16 | }) 17 | 18 | test_that("wrap", { 19 | (regularPlot <- ggally_points( 20 | iris, 21 | ggplot2::aes(Sepal.Length, Sepal.Width), 22 | size = 5, 23 | color = "red" 24 | )) 25 | 26 | # Wrap ggally_points to have parameter values size = 5 and color = 'red' 27 | w_ggally_points <- wrap(ggally_points, size = 5, color = "red") 28 | (wrappedPlot <- w_ggally_points( 29 | iris, 30 | ggplot2::aes(Sepal.Length, Sepal.Width) 31 | )) 32 | 33 | # Double check the aes parameters are the same for the geom_point layer 34 | expect_true(identical( 35 | regularPlot$layers[[1]]$aes_params, 36 | wrappedPlot$layers[[1]]$aes_params 37 | )) 38 | }) 39 | -------------------------------------------------------------------------------- /man/pigs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-pigs.R 3 | \docType{data} 4 | \name{pigs} 5 | \alias{pigs} 6 | \title{United Kingdom Pig Production} 7 | \format{ 8 | A data frame with 48 rows and 8 variables 9 | } 10 | \usage{ 11 | data(pigs) 12 | } 13 | \description{ 14 | This data contains about the United Kingdom Pig Production from the book 'Data' by Andrews and Herzberg. The original data can be on Statlib: http://lib.stat.cmu.edu/datasets/Andrews/T62.1 15 | } 16 | \details{ 17 | The time variable has been added from a combination of year and quarter 18 | 19 | \itemize{ 20 | \item time year + (quarter - 1) / 4 21 | \item year year of production 22 | \item quarter quarter of the year of production 23 | \item gilts number of sows giving birth for the first time 24 | \item profit ratio of price to an index of feed price 25 | \item s_per_herdsz ratio of the number of breeding pigs slaughtered to the total breeding herd size 26 | \item production number of pigs slaughtered that were reared for meat 27 | \item herdsz breeding herd size 28 | } 29 | } 30 | \references{ 31 | Andrews, David F., and Agnes M. Herzberg. Data: a collection of problems from many fields for the student and research worker. Springer Science & Business Media, 2012. 32 | } 33 | \keyword{datasets} 34 | -------------------------------------------------------------------------------- /tests/testthat/test-ggfacet.R: -------------------------------------------------------------------------------- 1 | test_that("simple test with iris data", { 2 | p <- ggfacet(iris, columnsX = 1:2, columnsY = 3:4) 3 | expect_s3_class(p, "ggplot") 4 | expect_equal(dim(p$data), c(4L * nrow(iris), ncol(iris) + 4L)) 5 | 6 | expect_equal( 7 | dim(ggfacet(mtcars, columnsX = 1:2, columnsY = 3:5)$data), 8 | c(6L * nrow(mtcars), ncol(mtcars) + 4L) 9 | ) 10 | }) 11 | 12 | test_that("warnings", { 13 | expect_warning( 14 | ggfacet(iris, columnsX = 1:5, columnsY = 1), 15 | "1 factor variables are being removed from X columns" 16 | ) 17 | expect_warning( 18 | ggfacet(iris, columnsX = 1, columnsY = 1:5), 19 | "1 factor variables are being removed from Y columns" 20 | ) 21 | }) 22 | 23 | test_that("generally works", { 24 | skip_if_not_installed("chemometrics") 25 | 26 | data(NIR, package = "chemometrics") 27 | NIR_sub <- data.frame(NIR$yGlcEtOH, NIR$xNIR[, 1:3]) 28 | 29 | # factor variables 30 | ggally_expect_doppelganger( 31 | "factor", 32 | ggfacet( 33 | NIR_sub, 34 | columnsY = 1:2, 35 | columnsX = 3:5, 36 | fn = ggally_smooth_loess 37 | ) 38 | ) 39 | 40 | ggally_expect_doppelganger( 41 | "pigs", 42 | ggts( 43 | pigs, 44 | "time", 45 | c("gilts", "profit", "s_per_herdsz", "production", "herdsz") 46 | ) 47 | ) 48 | }) 49 | -------------------------------------------------------------------------------- /man/reexports.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/reexports.R 3 | \docType{import} 4 | \name{reexports} 5 | \alias{reexports} 6 | \alias{ggcoef_model} 7 | \alias{ggcoef_compare} 8 | \alias{ggcoef_multinom} 9 | \alias{ggcoef_plot} 10 | \alias{signif_stars} 11 | \alias{geom_stripped_cols} 12 | \alias{geom_stripped_rows} 13 | \alias{stat_cross} 14 | \alias{StatCross} 15 | \alias{stat_prop} 16 | \alias{StatProp} 17 | \alias{stat_weighted_mean} 18 | \alias{StatWeightedMean} 19 | \title{Objects exported from other packages} 20 | \keyword{internal} 21 | \description{ 22 | These objects are imported from other packages. Follow the links 23 | below to see their documentation. 24 | 25 | \describe{ 26 | \item{ggstats}{\code{\link[ggstats:geom_stripped_rows]{geom_stripped_cols}}, \code{\link[ggstats]{geom_stripped_rows}}, \code{\link[ggstats:ggcoef_model]{ggcoef_compare}}, \code{\link[ggstats]{ggcoef_model}}, \code{\link[ggstats:ggcoef_multicomponents]{ggcoef_multinom}}, \code{\link[ggstats:ggcoef_model]{ggcoef_plot}}, \code{\link[ggstats]{signif_stars}}, \code{\link[ggstats]{stat_cross}}, \code{\link[ggstats]{stat_prop}}, \code{\link[ggstats]{stat_weighted_mean}}, \code{\link[ggstats:stat_cross]{StatCross}}, \code{\link[ggstats:stat_prop]{StatProp}}, \code{\link[ggstats:stat_weighted_mean]{StatWeightedMean}}} 27 | }} 28 | 29 | -------------------------------------------------------------------------------- /tests/testthat/test-ggmatrix_getput.R: -------------------------------------------------------------------------------- 1 | data(tips) 2 | 3 | test_that("stops", { 4 | pm <- ggpairs(tips) 5 | p <- ggally_blankDiag() 6 | expect_snapshot(pm["total_bill", 1], error = TRUE) 7 | expect_snapshot(pm[1, "total_bill"], error = TRUE) 8 | expect_snapshot(pm["total_bill", 1] <- p, error = TRUE) 9 | expect_snapshot(pm[1, "total_bill"] <- p, error = TRUE) 10 | 11 | pm <- ggduo(tips, 1:3, 1:4) 12 | expect_snapshot(pm[0, 1], error = TRUE) 13 | expect_snapshot(pm[1, 0], error = TRUE) 14 | expect_snapshot(pm[5, 1], error = TRUE) 15 | expect_snapshot(pm[1, 4], error = TRUE) 16 | 17 | for (i in 1:4) { 18 | for (j in 1:3) { 19 | expect_silent({ 20 | p <- pm[i, j] 21 | }) 22 | } 23 | } 24 | }) 25 | 26 | 27 | test_that("get", { 28 | a <- ggpairs( 29 | tips, 30 | 1:4, 31 | axisLabels = "show" 32 | ) 33 | p <- a[2, 1] 34 | labs <- get_labs(p) 35 | expect_equal(labs$x, "total_bill") 36 | expect_equal(labs$y, "tip") 37 | 38 | # test odd input and retrieve it 39 | a[2, 1] <- 1:4 40 | expect_snapshot(a[2, 1], error = TRUE) 41 | }) 42 | 43 | test_that("put", { 44 | a <- ggpairs( 45 | tips, 46 | 1:4, 47 | axisLabels = "show" 48 | ) 49 | txt <- "My Custom Plot" 50 | a[2, 1] <- ggally_text(txt) 51 | p <- a[2, 1] 52 | expect_equal(get("aes_params", envir = p$layers[[1]])$label, txt) 53 | }) 54 | -------------------------------------------------------------------------------- /man/figures/lifecycle-defunct.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: defunct 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | lifecycle 18 | 19 | defunct 20 | 21 | 22 | -------------------------------------------------------------------------------- /man/figures/lifecycle-archived.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: archived 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | lifecycle 18 | 19 | archived 20 | 21 | 22 | -------------------------------------------------------------------------------- /man/figures/lifecycle-maturing.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: maturing 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | lifecycle 18 | 19 | maturing 20 | 21 | 22 | -------------------------------------------------------------------------------- /man/figures/lifecycle-deprecated.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: deprecated 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | lifecycle 18 | 19 | deprecated 20 | 21 | 22 | -------------------------------------------------------------------------------- /man/figures/lifecycle-superseded.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: superseded 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | lifecycle 18 | 19 | superseded 20 | 21 | 22 | -------------------------------------------------------------------------------- /man/figures/lifecycle-questioning.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: questioning 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | lifecycle 18 | 19 | questioning 20 | 21 | 22 | -------------------------------------------------------------------------------- /man/fn_switch.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{fn_switch} 4 | \alias{fn_switch} 5 | \title{Function switch} 6 | \usage{ 7 | fn_switch(types, mapping_val = "y") 8 | } 9 | \arguments{ 10 | \item{types}{list of functions that follow the \code{\link{ggmatrix}} function standard: \code{function(data, mapping, ...){ #make ggplot2 object }}. One key should be a 'default' key for a default switch case.} 11 | 12 | \item{mapping_val}{mapping value to switch on. Defaults to the 'y' variable of the aesthetics list.} 13 | } 14 | \description{ 15 | Function that allows you to call different functions based upon an aesthetic variable value. 16 | } 17 | \examples{ 18 | ggnostic_continuous_fn <- fn_switch(list( 19 | default = ggally_points, 20 | .fitted = ggally_points, 21 | .se.fit = ggally_nostic_se_fit, 22 | .resid = ggally_nostic_resid, 23 | .hat = ggally_nostic_hat, 24 | .sigma = ggally_nostic_sigma, 25 | .cooksd = ggally_nostic_cooksd, 26 | .std.resid = ggally_nostic_std_resid 27 | )) 28 | 29 | ggnostic_combo_fn <- fn_switch(list( 30 | default = ggally_box_no_facet, 31 | fitted = ggally_box_no_facet, 32 | .se.fit = ggally_nostic_se_fit, 33 | .resid = ggally_nostic_resid, 34 | .hat = ggally_nostic_hat, 35 | .sigma = ggally_nostic_sigma, 36 | .cooksd = ggally_nostic_cooksd, 37 | .std.resid = ggally_nostic_std_resid 38 | )) 39 | } 40 | -------------------------------------------------------------------------------- /man/figures/lifecycle-experimental.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: experimental 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | lifecycle 18 | 19 | experimental 20 | 21 | 22 | -------------------------------------------------------------------------------- /man/figures/lifecycle-soft-deprecated.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: soft-deprecated 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | lifecycle 18 | 19 | soft-deprecated 20 | 21 | 22 | -------------------------------------------------------------------------------- /man/ggally_ratio.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_ratio} 4 | \alias{ggally_ratio} 5 | \title{Mosaic plot} 6 | \usage{ 7 | ggally_ratio( 8 | data, 9 | mapping = ggplot2::aes(!!!stats::setNames(lapply(colnames(data)[1:2], as.name), c("x", 10 | "y"))), 11 | ..., 12 | floor = 0, 13 | ceiling = NULL 14 | ) 15 | } 16 | \arguments{ 17 | \item{data}{data set using} 18 | 19 | \item{mapping}{aesthetics being used. Only x and y will used and both are required} 20 | 21 | \item{...}{passed to \code{\link[ggplot2]{geom_tile}(...)}} 22 | 23 | \item{floor}{don't display cells smaller than this value} 24 | 25 | \item{ceiling}{max value to scale frequencies. If any frequency is larger than the ceiling, the fill color is displayed darker than other rectangles} 26 | } 27 | \description{ 28 | Plots the mosaic plot by using fluctuation. 29 | } 30 | \examples{ 31 | # Small function to display plots only if it's interactive 32 | p_ <- GGally::print_if_interactive 33 | 34 | data(tips) 35 | p_(ggally_ratio(tips, ggplot2::aes(sex, day))) 36 | p_(ggally_ratio(tips, ggplot2::aes(sex, day)) + ggplot2::coord_equal()) 37 | # only plot tiles greater or equal to 20 and scale to a max of 50 38 | p_(ggally_ratio( 39 | tips, ggplot2::aes(sex, day), 40 | floor = 20, ceiling = 50 41 | ) + ggplot2::theme(aspect.ratio = 4 / 2)) 42 | } 43 | \author{ 44 | Barret Schloerke 45 | } 46 | \keyword{hplot} 47 | -------------------------------------------------------------------------------- /man/ggscatmat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggscatmat.R 3 | \name{ggscatmat} 4 | \alias{ggscatmat} 5 | \title{Traditional scatterplot matrix for purely quantitative variables} 6 | \usage{ 7 | ggscatmat( 8 | data, 9 | columns = 1:ncol(data), 10 | color = NULL, 11 | alpha = 1, 12 | corMethod = "pearson" 13 | ) 14 | } 15 | \arguments{ 16 | \item{data}{a data matrix. Should contain numerical (continuous) data.} 17 | 18 | \item{columns}{an option to choose the column to be used in the raw dataset. Defaults to \code{1:ncol(data)}.} 19 | 20 | \item{color}{an option to group the dataset by the factor variable and color them by different colors. 21 | Defaults to \code{NULL}, i.e. no coloring. If supplied, it will be converted to a factor.} 22 | 23 | \item{alpha}{an option to set the transparency in scatterplots for large data. Defaults to \code{1}.} 24 | 25 | \item{corMethod}{method argument supplied to \code{\link[stats]{cor}}} 26 | } 27 | \description{ 28 | This function makes a scatterplot matrix for quantitative variables with density plots on the diagonal 29 | and correlation printed in the upper triangle. 30 | } 31 | \examples{ 32 | # small function to display plots only if it's interactive 33 | p_ <- GGally::print_if_interactive 34 | 35 | data(flea) 36 | 37 | p_(ggscatmat(flea, columns = 2:4)) 38 | p_(ggscatmat(flea, columns = 2:4, color = "species")) 39 | } 40 | \author{ 41 | Mengjia Ni, Di Cook 42 | } 43 | -------------------------------------------------------------------------------- /man/figures/lifecycle-stable.svg: -------------------------------------------------------------------------------- 1 | 2 | lifecycle: stable 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | lifecycle 21 | 22 | 25 | 26 | stable 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /man/ggally_smooth.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_smooth} 4 | \alias{ggally_smooth} 5 | \alias{ggally_smooth_loess} 6 | \alias{ggally_smooth_lm} 7 | \title{Scatter plot with a smoothed line} 8 | \usage{ 9 | ggally_smooth( 10 | data, 11 | mapping, 12 | ..., 13 | method = "lm", 14 | formula = y ~ x, 15 | se = TRUE, 16 | shrink = TRUE 17 | ) 18 | 19 | ggally_smooth_loess(data, mapping, ...) 20 | 21 | ggally_smooth_lm(data, mapping, ...) 22 | } 23 | \arguments{ 24 | \item{data}{data set using} 25 | 26 | \item{mapping}{aesthetics being used} 27 | 28 | \item{method, se}{parameters supplied to \code{\link[ggplot2]{geom_smooth}}} 29 | 30 | \item{formula, ...}{other arguments to add to geom_smooth} 31 | 32 | \item{shrink}{boolean to determine if y range is reduced to range of points or points and error ribbon} 33 | } 34 | \description{ 35 | Add a smoothed condition mean with a given scatter plot. 36 | } 37 | \details{ 38 | Y limits are reduced to match original Y range with the goal of keeping the Y axis the same across plots. 39 | } 40 | \examples{ 41 | # Small function to display plots only if it's interactive 42 | p_ <- GGally::print_if_interactive 43 | 44 | data(tips) 45 | p_(ggally_smooth(tips, mapping = ggplot2::aes(x = total_bill, y = tip))) 46 | p_(ggally_smooth(tips, mapping = ggplot2::aes(total_bill, tip, color = sex))) 47 | } 48 | \author{ 49 | Barret Schloerke 50 | } 51 | \keyword{hplot} 52 | -------------------------------------------------------------------------------- /man/ggally_diagAxis.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_diagAxis} 4 | \alias{ggally_diagAxis} 5 | \title{Internal axis labels for ggpairs} 6 | \usage{ 7 | ggally_diagAxis( 8 | data, 9 | mapping, 10 | label = mapping$x, 11 | labelSize = 5, 12 | labelXPercent = 0.5, 13 | labelYPercent = 0.55, 14 | labelHJust = 0.5, 15 | labelVJust = 0.5, 16 | gridLabelSize = 4, 17 | ... 18 | ) 19 | } 20 | \arguments{ 21 | \item{data}{dataset being plotted} 22 | 23 | \item{mapping}{aesthetics being used (x is the variable the plot will be made for)} 24 | 25 | \item{label}{title to be displayed in the middle. Defaults to \code{mapping$x}} 26 | 27 | \item{labelSize}{size of variable label} 28 | 29 | \item{labelXPercent}{percent of horizontal range} 30 | 31 | \item{labelYPercent}{percent of vertical range} 32 | 33 | \item{labelHJust}{hjust supplied to label} 34 | 35 | \item{labelVJust}{vjust supplied to label} 36 | 37 | \item{gridLabelSize}{size of grid labels} 38 | 39 | \item{...}{other arguments for geom_text} 40 | } 41 | \description{ 42 | This function is used when \code{axisLabels == "internal"}. 43 | } 44 | \examples{ 45 | # Small function to display plots only if it's interactive 46 | p_ <- GGally::print_if_interactive 47 | 48 | data(tips) 49 | p_(ggally_diagAxis(tips, ggplot2::aes(x = tip))) 50 | p_(ggally_diagAxis(tips, ggplot2::aes(x = sex))) 51 | } 52 | \author{ 53 | Jason Crowley and Barret Schloerke 54 | } 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [GGally](http://ggobi.github.io/ggally/): Extension to [ggplot2](https://ggplot2.tidyverse.org/) 2 | 3 | 4 | [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/GGally)](https://cran.r-project.org/package=GGally) 5 | [![](http://cranlogs.r-pkg.org/badges/GGally)](https://cran.r-project.org/package=GGally) 6 | [![R-CMD-check](https://github.com/ggobi/ggally/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ggobi/ggally/actions/workflows/R-CMD-check.yaml) 7 | [![DOI](https://zenodo.org/badge/22529/ggobi/ggally.svg)](https://zenodo.org/badge/latestdoi/22529/ggobi/ggally) 8 | [![RStudio community](https://img.shields.io/badge/community-GGally-blue?style=social&logo=rstudio&logoColor=75AADB)](https://forum.posit.co/tags/c/general/17/ggally) 9 | 10 | 11 | 12 | [`ggplot2`](https://ggplot2.tidyverse.org/) is a plotting system for R based on the grammar of graphics. [`GGally`](https://ggobi.github.io/ggally/) extends ggplot2 by adding several functions to reduce the complexity of combining geoms with transformed data. Some of these functions include a pairwise plot matrix, a scatterplot plot matrix, a parallel coordinates plot, a survival plot, and several functions to plot networks. 13 | 14 | ## Installation 15 | 16 | To install this package from GitHub or [CRAN](https://cran.r-project.org/package=GGally), do the following from the R console: 17 | 18 | ```r 19 | # Github 20 | pak::pak("ggobi/ggally") 21 | ``` 22 | 23 | ```r 24 | # CRAN 25 | install.packages("GGally") 26 | ``` 27 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/ggmatrix_getput.md: -------------------------------------------------------------------------------- 1 | # stops 2 | 3 | Code 4 | pm["total_bill", 1] 5 | Condition 6 | Error in `check_i_j()`: 7 | ! `i` may only be a single numeric value 8 | 9 | --- 10 | 11 | Code 12 | pm[1, "total_bill"] 13 | Condition 14 | Error in `check_i_j()`: 15 | ! `j` may only be a single numeric value 16 | 17 | --- 18 | 19 | Code 20 | pm["total_bill", 1] <- p 21 | Condition 22 | Error in `check_i_j()`: 23 | ! `i` may only be a single numeric value 24 | 25 | --- 26 | 27 | Code 28 | pm[1, "total_bill"] <- p 29 | Condition 30 | Error in `check_i_j()`: 31 | ! `j` may only be a single numeric value 32 | 33 | --- 34 | 35 | Code 36 | pm[0, 1] 37 | Condition 38 | Error in `check_i_j()`: 39 | ! `i` may only be in the range from 1:4 40 | 41 | --- 42 | 43 | Code 44 | pm[1, 0] 45 | Condition 46 | Error in `check_i_j()`: 47 | ! `j` may only be in the range from 1:3 48 | 49 | --- 50 | 51 | Code 52 | pm[5, 1] 53 | Condition 54 | Error in `check_i_j()`: 55 | ! `i` may only be in the range from 1:4 56 | 57 | --- 58 | 59 | Code 60 | pm[1, 4] 61 | Condition 62 | Error in `check_i_j()`: 63 | ! `j` may only be in the range from 1:3 64 | 65 | # get 66 | 67 | Code 68 | a[2, 1] 69 | Condition 70 | Error in `getPlot()`: 71 | ! unknown plot object type. 72 | i Position: i = 2, j = 1 str(plotObj): int [1:4] 1 2 3 4 73 | 74 | -------------------------------------------------------------------------------- /R/data-baseball.R: -------------------------------------------------------------------------------- 1 | #' Yearly batting records for all major league baseball players 2 | #' 3 | #' This data frame contains batting statistics for a subset of players 4 | #' collected from \url{http://www.baseball-databank.org/}. There are a total 5 | #' of 21,699 records, covering 1,228 players from 1871 to 2007. Only players 6 | #' with more 15 seasons of play are included. 7 | #' 8 | #' @section Variables: 9 | #' Variables: 10 | #' \itemize{ 11 | #' \item id, unique player id 12 | #' \item year, year of data 13 | #' \item stint 14 | #' \item team, team played for 15 | #' \item lg, league 16 | #' \item g, number of games 17 | #' \item ab, number of times at bat 18 | #' \item r, number of runs 19 | #' \item h, hits, times reached base because of a batted, fair ball without 20 | #' error by the defense 21 | #' \item X2b, hits on which the batter reached second base safely 22 | #' \item X3b, hits on which the batter reached third base safely 23 | #' \item hr, number of home runs 24 | #' \item rbi, runs batted in 25 | #' \item sb, stolen bases 26 | #' \item cs, caught stealing 27 | #' \item bb, base on balls (walk) 28 | #' \item so, strike outs 29 | #' \item ibb, intentional base on balls 30 | #' \item hbp, hits by pitch 31 | #' \item sh, sacrifice hits 32 | #' \item sf, sacrifice flies 33 | #' \item gidp, ground into double play 34 | #' } 35 | #' @docType data 36 | #' @name baseball 37 | #' @usage baseball 38 | #' @format A 21699 x 22 data frame 39 | #' @references \url{http://www.baseball-databank.org/} 40 | #' @keywords datasets 41 | "baseball" 42 | -------------------------------------------------------------------------------- /man/ggally_nostic_cooksd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{ggally_nostic_cooksd} 4 | \alias{ggally_nostic_cooksd} 5 | \title{\code{\link{ggnostic}} Cook's distance} 6 | \usage{ 7 | ggally_nostic_cooksd( 8 | data, 9 | mapping, 10 | ..., 11 | linePosition = pf(0.5, length(attr(data, "var_x")), nrow(data) - length(attr(data, 12 | "var_x"))), 13 | lineColor = brew_colors("grey"), 14 | lineType = 2 15 | ) 16 | } 17 | \arguments{ 18 | \item{data, mapping, ..., lineColor, lineType}{parameters supplied to \code{\link{ggally_nostic_line}}} 19 | 20 | \item{linePosition}{4 / n is the general cutoff point for Cook's Distance} 21 | } 22 | \value{ 23 | \pkg{ggplot2} plot object 24 | } 25 | \description{ 26 | A function to display \code{\link[stats:influence.measures]{stats::cooks.distance()}}. 27 | } 28 | \details{ 29 | A line is added at \eqn{F_{p,n-p}(0.5)}{F[p,n-p](0.5)} to display the general cutoff point for Cook's Distance. 30 | 31 | Reference: Michael H. Kutner, Christopher J. Nachtsheim, John Neter, and William Li. Applied linear statistical models. The McGraw-Hill / Irwin series operations and decision sciences. McGraw-Hill Irwin, 2005, p. 403 32 | } 33 | \examples{ 34 | # Small function to display plots only if it's interactive 35 | p_ <- GGally::print_if_interactive 36 | 37 | dt <- broomify(stats::lm(mpg ~ wt + qsec + am, data = mtcars)) 38 | p_(ggally_nostic_cooksd(dt, ggplot2::aes(wt, .cooksd))) 39 | } 40 | \seealso{ 41 | \code{\link[stats:influence.measures]{stats::cooks.distance()}} 42 | } 43 | -------------------------------------------------------------------------------- /man/v1_ggmatrix_theme.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/deprecated.R 3 | \name{v1_ggmatrix_theme} 4 | \alias{v1_ggmatrix_theme} 5 | \title{Modify a \code{\link{ggmatrix}} object by adding an \pkg{ggplot2} object to all} 6 | \usage{ 7 | v1_ggmatrix_theme() 8 | } 9 | \description{ 10 | \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} 11 | 12 | This function allows cleaner axis labels for your plots, but is deprecated. 13 | You can achieve the same effect by specifying strip's background and placement 14 | properties (see Examples). 15 | } 16 | \examples{ 17 | # Small function to display plots only if it's interactive 18 | p_ <- GGally::print_if_interactive 19 | 20 | # Cleaner axis labels with v1_ggmatrix_theme 21 | p_(ggpairs(iris, 1:2) + v1_ggmatrix_theme()) 22 | 23 | # Move the column names to the left and bottom 24 | p_(ggpairs(iris, 1:2, switch = "both") + v1_ggmatrix_theme()) 25 | 26 | # Manually specifying axis labels properties 27 | p_( 28 | ggpairs(iris, 1:2) + 29 | theme( 30 | strip.background = element_rect(fill = "white"), 31 | strip.placement = "outside" 32 | ) 33 | ) 34 | 35 | # This way you have even more control over how the final plot looks. 36 | # For example, if you want to set the background color to yellow: 37 | p_( 38 | ggpairs(iris, 1:2) + 39 | theme( 40 | strip.background = element_rect(fill = "yellow"), 41 | strip.placement = "outside" 42 | ) 43 | ) 44 | } 45 | \keyword{internal} 46 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/crosstalk.md: -------------------------------------------------------------------------------- 1 | # crosstalk works with ggduo and ggpairs 2 | 3 | Code 4 | ggpairs(sd, 3:5) 5 | Condition 6 | Error in `fix_column_values()`: 7 | ! Make sure your numeric "columns" values are less than or equal to 4. 8 | * columns = c(3, 4, 5) 9 | 10 | --- 11 | 12 | Code 13 | ggpairs(sd, c("Petal.Length", "Petal.Width", crosstalk_key())) 14 | Condition 15 | Error in `fix_column_values()`: 16 | ! Columns in `columns` not found in data: `'.crossTalkKey'`. 17 | i Choices: `Sepal.Length`, `Sepal.Width`, `Petal.Length`, and `Petal.Width` 18 | 19 | --- 20 | 21 | Code 22 | ggduo(sd, c(1:2, 5), 3:5) 23 | Condition 24 | Error in `fix_column_values()`: 25 | ! Make sure your numeric "columnsX" values are less than or equal to 4. 26 | * columnsX = c(1, 2, 5) 27 | 28 | --- 29 | 30 | Code 31 | ggduo(sd, c("Sepal.Length", "Sepal.Width", crosstalk_key()), c("Petal.Length", 32 | "Petal.Width")) 33 | Condition 34 | Error in `fix_column_values()`: 35 | ! Columns in `columnsX` not found in data: `'.crossTalkKey'`. 36 | i Choices: `Sepal.Length`, `Sepal.Width`, `Petal.Length`, and `Petal.Width` 37 | 38 | --- 39 | 40 | Code 41 | ggduo(sd, c("Sepal.Length", "Sepal.Width"), c("Petal.Length", "Petal.Width", 42 | crosstalk_key())) 43 | Condition 44 | Error in `fix_column_values()`: 45 | ! Columns in `columnsY` not found in data: `'.crossTalkKey'`. 46 | i Choices: `Sepal.Length`, `Sepal.Width`, `Petal.Length`, and `Petal.Width` 47 | 48 | -------------------------------------------------------------------------------- /man/ggally_nostic_sigma.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{ggally_nostic_sigma} 4 | \alias{ggally_nostic_sigma} 5 | \title{\code{\link{ggnostic}} leave one out model sigma} 6 | \usage{ 7 | ggally_nostic_sigma( 8 | data, 9 | mapping, 10 | ..., 11 | lineColor = brew_colors("grey"), 12 | linePosition = attr(data, "broom_glance")$sigma 13 | ) 14 | } 15 | \arguments{ 16 | \item{data, mapping, ..., lineColor}{parameters supplied to \code{\link{ggally_nostic_line}}} 17 | 18 | \item{linePosition}{line that is drawn in the background of the plot. Defaults to the overall model's sigma value.} 19 | } 20 | \value{ 21 | \pkg{ggplot2} plot object 22 | } 23 | \description{ 24 | A function to display \code{\link[stats:lm.influence]{stats::influence()}}'s sigma value. 25 | } 26 | \details{ 27 | As stated in \code{\link[stats:lm.influence]{stats::influence()}} documentation: 28 | 29 | sigma: a vector whose i-th element contains the estimate of the residual standard deviation obtained when the i-th case is dropped from the regression. (The approximations needed for GLMs can result in this being 'NaN'.) 30 | 31 | A line is added to display the overall model's sigma value. This gives a baseline for comparison 32 | } 33 | \examples{ 34 | # Small function to display plots only if it's interactive 35 | p_ <- GGally::print_if_interactive 36 | 37 | dt <- broomify(stats::lm(mpg ~ wt + qsec + am, data = mtcars)) 38 | p_(ggally_nostic_sigma(dt, ggplot2::aes(wt, .sigma))) 39 | } 40 | \seealso{ 41 | \code{\link[stats:lm.influence]{stats::influence()}} 42 | } 43 | -------------------------------------------------------------------------------- /man/baseball.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-baseball.R 3 | \docType{data} 4 | \name{baseball} 5 | \alias{baseball} 6 | \title{Yearly batting records for all major league baseball players} 7 | \format{ 8 | A 21699 x 22 data frame 9 | } 10 | \usage{ 11 | baseball 12 | } 13 | \description{ 14 | This data frame contains batting statistics for a subset of players 15 | collected from \url{http://www.baseball-databank.org/}. There are a total 16 | of 21,699 records, covering 1,228 players from 1871 to 2007. Only players 17 | with more 15 seasons of play are included. 18 | } 19 | \section{Variables}{ 20 | 21 | Variables: 22 | \itemize{ 23 | \item id, unique player id 24 | \item year, year of data 25 | \item stint 26 | \item team, team played for 27 | \item lg, league 28 | \item g, number of games 29 | \item ab, number of times at bat 30 | \item r, number of runs 31 | \item h, hits, times reached base because of a batted, fair ball without 32 | error by the defense 33 | \item X2b, hits on which the batter reached second base safely 34 | \item X3b, hits on which the batter reached third base safely 35 | \item hr, number of home runs 36 | \item rbi, runs batted in 37 | \item sb, stolen bases 38 | \item cs, caught stealing 39 | \item bb, base on balls (walk) 40 | \item so, strike outs 41 | \item ibb, intentional base on balls 42 | \item hbp, hits by pitch 43 | \item sh, sacrifice hits 44 | \item sf, sacrifice flies 45 | \item gidp, ground into double play 46 | } 47 | } 48 | 49 | \references{ 50 | \url{http://www.baseball-databank.org/} 51 | } 52 | \keyword{datasets} 53 | -------------------------------------------------------------------------------- /R/vig_ggally.R: -------------------------------------------------------------------------------- 1 | #' View GGally vignettes 2 | #' 3 | #' This function will open the directly to the vignette requested. If no \code{name} is provided, the index of all \pkg{GGally} vignettes will be opened. 4 | #' 5 | #' This method allows for vignettes to be hosted remotely, reducing \pkg{GGally}'s package size, and installation time. 6 | #' 7 | #' @param name Vignette name to open. If no name is provided, the vignette index will be opened 8 | #' @export 9 | #' @examples 10 | #' \donttest{ 11 | #' # View `ggnostic` vignette 12 | #' vig_ggally("ggnostic") 13 | #' 14 | #' # View all vignettes by GGally 15 | #' vig_ggally() 16 | #' } 17 | vig_ggally <- function(name) { 18 | vig_url <- 19 | if (missing(name) || is.null(name)) { 20 | "https://ggobi.github.io/ggally/articles/" 21 | } else { 22 | tryCatch( 23 | { 24 | paste0( 25 | "https://ggobi.github.io/ggally/articles/", 26 | match.arg(name, vignettes_for_ggally), 27 | ".html" 28 | ) 29 | }, 30 | error = function(e) { 31 | cli::cli_inform( 32 | "Unknown vignette: {name}. Opening Vignette index page" 33 | ) 34 | "https://ggobi.github.io/ggally/articles/" 35 | } 36 | ) 37 | } 38 | 39 | browseURL(vig_url) 40 | } 41 | 42 | vignettes_for_ggally <- c( 43 | "ggally_plots", 44 | "ggally_stats", 45 | "ggbivariate", 46 | "ggcoef_model", 47 | "ggcoef", 48 | "ggduo", 49 | "ggmatrix", 50 | "ggnetworkmap", 51 | "ggnostic", 52 | "ggpairs", 53 | "ggscatmat", 54 | "ggsurv", 55 | "ggtable", 56 | "glyph" 57 | ) 58 | -------------------------------------------------------------------------------- /tests/testthat/test-ggtable.R: -------------------------------------------------------------------------------- 1 | suppressMessages(require(broom)) 2 | 3 | test_that("example", { 4 | skip_if_not_installed("Hmisc") 5 | reg <- lm( 6 | Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, 7 | data = iris 8 | ) 9 | ggally_expect_doppelganger("lm", ggcoef(reg)) 10 | 11 | data(tips) 12 | ggally_expect_doppelganger( 13 | "tips", 14 | ggtable(tips, "smoker", c("day", "time", "sex")) 15 | ) 16 | 17 | # displaying row proportions 18 | ggally_expect_doppelganger( 19 | "tips-cells", 20 | ggtable(tips, "smoker", c("day", "time", "sex"), cells = "row.prop") 21 | ) 22 | 23 | # filling cells with residuals 24 | ggally_expect_doppelganger( 25 | "tips-fill-std_resid", 26 | ggtable( 27 | tips, 28 | "smoker", 29 | c("day", "time", "sex"), 30 | fill = "std.resid", 31 | legend = 1 32 | ) 33 | ) 34 | ggally_expect_doppelganger( 35 | "tips-fill-resid", 36 | ggtable(tips, "smoker", c("day", "time", "sex"), fill = "resid", legend = 1) 37 | ) 38 | 39 | # if continuous variables are provided, just displaying some summary statistics 40 | ggally_expect_doppelganger( 41 | "tips-continuous", 42 | ggtable(tips, c("smoker", "total_bill"), c("day", "time", "sex", "tip")) 43 | ) 44 | 45 | # specifying weights 46 | d <- as.data.frame(Titanic) 47 | ggally_expect_doppelganger( 48 | "titanic-weight-freq", 49 | ggtable( 50 | d, 51 | "Survived", 52 | c("Class", "Sex", "Age"), 53 | mapping = aes(weight = Freq), 54 | cells = "row.prop", 55 | fill = "std.resid" 56 | ) 57 | ) 58 | }) 59 | -------------------------------------------------------------------------------- /man/ggally_autopoint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_autopoint} 4 | \alias{ggally_autopoint} 5 | \alias{ggally_autopointDiag} 6 | \title{Scatterplot for continuous and categorical variables} 7 | \usage{ 8 | ggally_autopoint(data, mapping, ...) 9 | 10 | ggally_autopointDiag(data, mapping, ...) 11 | } 12 | \arguments{ 13 | \item{data}{data set using} 14 | 15 | \item{mapping}{aesthetics being used} 16 | 17 | \item{...}{other arguments passed to \code{\link[ggforce]{geom_autopoint}(...)}} 18 | } 19 | \description{ 20 | Make scatterplots compatible with both continuous and categorical variables 21 | using \code{\link[ggforce]{geom_autopoint}} from package \pkg{ggforce}. 22 | } 23 | \examples{ 24 | # Small function to display plots only if it's interactive 25 | p_ <- GGally::print_if_interactive 26 | 27 | data(tips) 28 | p_(ggally_autopoint(tips, mapping = aes(x = tip, y = total_bill))) 29 | p_(ggally_autopoint(tips, mapping = aes(x = tip, y = sex))) 30 | p_(ggally_autopoint(tips, mapping = aes(x = smoker, y = sex))) 31 | p_(ggally_autopoint(tips, mapping = aes(x = smoker, y = sex, color = day))) 32 | p_(ggally_autopoint(tips, mapping = aes(x = smoker, y = sex), size = 8)) 33 | p_(ggally_autopoint(tips, mapping = aes(x = smoker, y = sex), alpha = .9)) 34 | 35 | p_(ggpairs( 36 | tips, 37 | mapping = aes(colour = sex), 38 | upper = list(discrete = "autopoint", combo = "autopoint", continuous = "autopoint"), 39 | diag = list(discrete = "autopointDiag", continuous = "autopointDiag") 40 | )) 41 | } 42 | \author{ 43 | Joseph Larmarange 44 | } 45 | \keyword{hplot} 46 | -------------------------------------------------------------------------------- /man/ggally_nostic_line.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{ggally_nostic_line} 4 | \alias{ggally_nostic_line} 5 | \title{\code{\link{ggnostic}} background line with geom} 6 | \usage{ 7 | ggally_nostic_line( 8 | data, 9 | mapping, 10 | ..., 11 | linePosition = NULL, 12 | lineColor = "red", 13 | lineSize = 0.5, 14 | lineAlpha = 1, 15 | lineType = 1, 16 | continuous_geom = ggplot2::geom_point, 17 | combo_geom = ggplot2::geom_boxplot, 18 | mapColorToFill = TRUE 19 | ) 20 | } 21 | \arguments{ 22 | \item{data, mapping}{supplied directly to \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}}} 23 | 24 | \item{...}{parameters supplied to \code{continuous_geom} or \code{combo_geom}} 25 | 26 | \item{linePosition, lineColor, lineSize, lineAlpha, lineType}{parameters supplied to 27 | \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}}} 28 | 29 | \item{continuous_geom}{\pkg{ggplot2} geom that is executed after the line is (possibly) 30 | added and if the x data is continuous} 31 | 32 | \item{combo_geom}{\pkg{ggplot2} geom that is executed after the line is (possibly) added and 33 | if the x data is discrete} 34 | 35 | \item{mapColorToFill}{boolean to determine if combo plots should cut the color mapping to the fill mapping} 36 | } 37 | \value{ 38 | \pkg{ggplot2} plot object 39 | } 40 | \description{ 41 | If a non-null \code{linePosition} value is given, a line will be drawn before the given \code{continuous_geom} or \code{combo_geom} is added to the plot. 42 | } 43 | \details{ 44 | Functions with a color in their name have different default color behavior. 45 | } 46 | -------------------------------------------------------------------------------- /man/ggally_nostic_se_fit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{ggally_nostic_se_fit} 4 | \alias{ggally_nostic_se_fit} 5 | \title{\code{\link{ggnostic}} fitted value's standard error} 6 | \usage{ 7 | ggally_nostic_se_fit( 8 | data, 9 | mapping, 10 | ..., 11 | lineColor = brew_colors("grey"), 12 | linePosition = NULL 13 | ) 14 | } 15 | \arguments{ 16 | \item{data, mapping, ..., lineColor}{parameters supplied to \code{\link{ggally_nostic_line}}} 17 | 18 | \item{linePosition}{base comparison for a perfect fit} 19 | } 20 | \value{ 21 | \pkg{ggplot2} plot object 22 | } 23 | \description{ 24 | A function to display \code{stats::\link[stats]{predict}}'s standard errors 25 | } 26 | \details{ 27 | As stated in \code{stats::\link[stats]{predict}} documentation: 28 | 29 | If the logical 'se.fit' is 'TRUE', standard errors of the predictions are calculated. If the numeric argument 'scale' is set (with optional ''df'), it is used as the residual standard deviation in the computation of the standard errors, otherwise this is extracted from the model fit. 30 | 31 | Since the se.fit is \code{TRUE} and scale is unset by default, the standard errors are extracted from the model fit. 32 | 33 | A base line of 0 is added to give reference to a perfect fit. 34 | } 35 | \examples{ 36 | # Small function to display plots only if it's interactive 37 | p_ <- GGally::print_if_interactive 38 | 39 | dt <- broomify(stats::lm(mpg ~ wt + qsec + am, data = mtcars)) 40 | p_(ggally_nostic_se_fit(dt, ggplot2::aes(wt, .se.fit))) 41 | } 42 | \seealso{ 43 | \code{\link[stats:lm.influence]{stats::influence()}} 44 | } 45 | -------------------------------------------------------------------------------- /man/putPlot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggpairs_getput.R 3 | \name{putPlot} 4 | \alias{putPlot} 5 | \alias{[<-.ggmatrix} 6 | \title{Insert a plot into a \code{\link{ggmatrix}} object} 7 | \usage{ 8 | putPlot(pm, value, i, j) 9 | 10 | \method{[}{ggmatrix}(pm, i, j, ...) <- value 11 | } 12 | \arguments{ 13 | \item{pm}{ggally object to be altered} 14 | 15 | \item{value}{ggplot object to be placed} 16 | 17 | \item{i}{row from the top} 18 | 19 | \item{j}{column from the left} 20 | 21 | \item{...}{ignored} 22 | } 23 | \description{ 24 | Function to place your own plot in the layout. 25 | } 26 | \examples{ 27 | # Small function to display plots only if it's interactive 28 | p_ <- GGally::print_if_interactive 29 | 30 | custom_car <- ggpairs(mtcars[, c("mpg", "wt", "cyl")], upper = "blank", title = "Custom Example") 31 | # ggplot example taken from example(geom_text) 32 | plot <- ggplot2::ggplot(mtcars, ggplot2::aes(x = wt, y = mpg, label = rownames(mtcars))) 33 | plot <- plot + 34 | ggplot2::geom_text(ggplot2::aes(colour = factor(cyl)), size = 3) + 35 | ggplot2::scale_colour_discrete(l = 40) 36 | custom_car[1, 2] <- plot 37 | personal_plot <- ggally_text( 38 | "ggpairs allows you\nto put in your\nown plot.\nLike that one.\n <---" 39 | ) 40 | custom_car[1, 3] <- personal_plot 41 | # custom_car 42 | 43 | # remove plots after creating a plot matrix 44 | custom_car[2, 1] <- NULL 45 | custom_car[3, 1] <- "blank" # the same as storing null 46 | custom_car[3, 2] <- NULL 47 | p_(custom_car) 48 | } 49 | \seealso{ 50 | \code{\link{getPlot}} 51 | } 52 | \author{ 53 | Barret Schloerke 54 | } 55 | \keyword{hplot} 56 | -------------------------------------------------------------------------------- /tests/testthat/test-ggbivariate.R: -------------------------------------------------------------------------------- 1 | test_that("example", { 2 | data(tips) 3 | 4 | p <- ggbivariate(tips, "smoker", c("day", "time", "sex", "tip")) 5 | ggally_expect_doppelganger("tips", p) 6 | 7 | # Personalize plot title and legend title 8 | p <- ggbivariate( 9 | tips, 10 | "smoker", 11 | c("day", "time", "sex", "tip"), 12 | title = "Custom title" 13 | ) + 14 | labs(fill = "Smoker ?") 15 | ggally_expect_doppelganger("tips-title", p) 16 | 17 | # Customize fill colour scale 18 | p <- ggbivariate(tips, "smoker", c("day", "time", "sex", "tip")) + 19 | scale_fill_brewer(type = "qual") 20 | ggally_expect_doppelganger("tips-fill-qual", p) 21 | 22 | # Customize labels 23 | p <- ggbivariate( 24 | tips, 25 | "smoker", 26 | c("day", "time", "sex", "tip"), 27 | rowbar_args = list( 28 | colour = "white", 29 | size = 4, 30 | fontface = "bold", 31 | label_format = scales::label_percent(accurary = 1) 32 | ) 33 | ) 34 | ggally_expect_doppelganger("tips-rowbar", p) 35 | 36 | # Choose the sub-plot from which get legend 37 | p <- ggbivariate(tips, "smoker") 38 | ggally_expect_doppelganger("tips-legend-default", p) 39 | 40 | ggbivariate(tips, "smoker", legend = 3) 41 | ggally_expect_doppelganger("tips-legend-3", p) 42 | 43 | # Use mapping to indicate weights 44 | d <- as.data.frame(Titanic) 45 | p <- ggbivariate(d, "Survived", mapping = aes(weight = Freq)) 46 | ggally_expect_doppelganger("titanic-weight-freq", p) 47 | 48 | # outcome can be numerical 49 | p <- ggbivariate(tips, outcome = "tip", title = "tip") 50 | ggally_expect_doppelganger("tips-numeric", p) 51 | }) 52 | -------------------------------------------------------------------------------- /vignettes/glyph.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "glyphs(): Glyph plot" 3 | output: rmarkdown::html_vignette 4 | author: "Hadley Wickham, Charlotte Wickham, Di Cook, Heike Hofmann" 5 | date: Nov 6, 2015 6 | vignette: > 7 | %\VignetteIndexEntry{glyphs(): Glyph plot} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | ```{r, include = FALSE} 13 | knitr::opts_chunk$set( 14 | collapse = TRUE, 15 | comment = "#>" 16 | ) 17 | ``` 18 | 19 | ```{r setup} 20 | library(GGally) 21 | ``` 22 | 23 | # `GGally::glyphs()` 24 | 25 | 26 | This function rearranges data to be able to construct a glyph plot 27 | 28 | ```{r glyphs-basic-usage, fig.height=7, fig.width=7} 29 | library(ggplot2) 30 | data(nasa) 31 | temp.gly <- glyphs(nasa, "long", "day", "lat", "surftemp", height = 2.5) 32 | ggplot(temp.gly, ggplot2::aes(gx, gy, group = gid)) + 33 | add_ref_lines(temp.gly, color = "grey90") + 34 | add_ref_boxes(temp.gly, color = "grey90") + 35 | geom_path() + 36 | theme_bw() + 37 | labs(x = "", y = "") 38 | ``` 39 | 40 | This shows a glyphplot of monthly surface temperature for 6 years over Central America. You can see differences from one location to another, that in large areas temperature doesn't change much. There are large seasonal trends in the top left over land. 41 | 42 | Rescaling in different ways puts emphasis on different components, see the examples in the referenced paper. And with ggplot2 you can make a map of the geographic area underlying the glyphs. 43 | 44 | ## References 45 | 46 | Wickham, H., Hofmann, H., Wickham, C. and Cook, D. (2012) 47 | Glyph-maps for Visually Exploring Temporal Patterns in Climate Data and Models, **Environmetrics**, *23*(5):151-182. 48 | -------------------------------------------------------------------------------- /vignettes/ggscatmat.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ggscatmat(): Numeric pairwise plot matrix" 3 | output: rmarkdown::html_vignette 4 | author: Di Cook, Mengjia Ni 5 | date: Nov 6, 2015 6 | vignette: > 7 | %\VignetteIndexEntry{ggscatmat(): Numeric pairwise plot matrix} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | ```{r, include = FALSE} 13 | knitr::opts_chunk$set( 14 | collapse = TRUE, 15 | comment = "#>" 16 | ) 17 | ``` 18 | 19 | ```{r setup} 20 | library(GGally) 21 | ``` 22 | 23 | 24 | # `GGally::ggscatmat()` 25 | 26 | 27 | 28 | The primary function is `ggscatmat()`. It is similar to `ggpairs()` but only works for purely numeric multivariate data. It is faster than `ggpairs()`, because less choices need to be made. It creates a matrix with scatterplots in the lower diagonal, densities on the diagonal and correlations written in the upper diagonal. Syntax is to enter the dataset, the columns that you want to plot, a color column, and an alpha level. 29 | 30 | ```{r ggscatmat-basic-usage, fig.height=7, fig.width=7} 31 | data(flea) 32 | ggscatmat(flea, columns = 2:4, color = "species", alpha = 0.8) 33 | ``` 34 | 35 | In this plot, you can see that the three different species vary a little from each other in these three variables. Heptapot (blue) has smaller values on the variable `tars1` than the other two. The correlation between the three variables is similar for all species. 36 | 37 | ## References 38 | 39 | John W Emerson, Walton A Green, Barret Schloerke, Jason Crowley, Dianne Cook, Heike Hofmann, Hadley Wickham. 40 | **[The Generalized Pairs Plot](http://vita.had.co.nz/papers/gpp.html)**. 41 | *Journal of Computational and Graphical Statistics*, vol. 22, no. 1, pp. 79-91, 2012. 42 | -------------------------------------------------------------------------------- /man/ggally_count.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \docType{data} 4 | \name{ggally_count} 5 | \alias{ggally_count} 6 | \alias{stat_ggally_count} 7 | \alias{StatGGallyCount} 8 | \alias{ggally_countDiag} 9 | \title{Display counts of observations} 10 | \usage{ 11 | ggally_count(data, mapping, ...) 12 | 13 | ggally_countDiag(data, mapping, ...) 14 | } 15 | \arguments{ 16 | \item{data}{data set using} 17 | 18 | \item{mapping}{aesthetics being used} 19 | 20 | \item{...}{other arguments passed to \code{\link[ggplot2]{geom_tile}(...)}} 21 | } 22 | \description{ 23 | Plot the number of observations by using rectangles 24 | with proportional areas. 25 | } 26 | \details{ 27 | You can adjust the size of rectangles with the \code{x.width} argument. 28 | } 29 | \examples{ 30 | # Small function to display plots only if it's interactive 31 | p_ <- GGally::print_if_interactive 32 | 33 | data(tips) 34 | p_(ggally_count(tips, mapping = ggplot2::aes(x = smoker, y = sex))) 35 | p_(ggally_count(tips, mapping = ggplot2::aes(x = smoker, y = sex, fill = day))) 36 | 37 | p_(ggally_count( 38 | as.data.frame(Titanic), 39 | mapping = ggplot2::aes(x = Class, y = Survived, weight = Freq) 40 | )) 41 | p_(ggally_count( 42 | as.data.frame(Titanic), 43 | mapping = ggplot2::aes(x = Class, y = Survived, weight = Freq), 44 | x.width = 0.5 45 | )) 46 | # Small function to display plots only if it's interactive 47 | p_ <- GGally::print_if_interactive 48 | 49 | p_(ggally_countDiag(tips, mapping = ggplot2::aes(x = smoker))) 50 | p_(ggally_countDiag(tips, mapping = ggplot2::aes(x = smoker, fill = sex))) 51 | } 52 | \author{ 53 | Joseph Larmarange 54 | } 55 | \keyword{datasets} 56 | \keyword{hplot} 57 | -------------------------------------------------------------------------------- /R/ggmatrix_make_plot.R: -------------------------------------------------------------------------------- 1 | make_label_plot <- function(types, sectionAes, label) { 2 | sectionAes$y <- NULL 3 | 4 | p <- make_ggmatrix_plot_obj( 5 | wrapp( 6 | "diagAxis", 7 | params = c("label" = label), 8 | funcArgName = "ggally_diagAxis" 9 | ), 10 | mapping = sectionAes 11 | ) 12 | return(p) 13 | } 14 | 15 | 16 | ggmatrix_plot_list <- (function() { 17 | make_diag_plot_wrapper <- function(sub_type_val) { 18 | plot_fn <- make_plot_wrapper(sub_type_val) 19 | 20 | function(types, sectionAes) { 21 | sectionAes$y <- NULL 22 | plot_fn(types, sectionAes) 23 | } 24 | } 25 | 26 | make_plot_wrapper <- function(sub_type_val) { 27 | function(types, sectionAes) { 28 | sub_type <- types[[sub_type_val]] 29 | sub_type_name <- get_subtype_name(sub_type) 30 | 31 | p <- make_ggmatrix_plot_obj( 32 | wrapp(sub_type, funcArgName = sub_type_name), 33 | mapping = sectionAes 34 | ) 35 | return(p) 36 | } 37 | } 38 | 39 | na_fn <- make_plot_wrapper("na") 40 | na_diag_fn <- make_plot_wrapper("na") 41 | continuous_fn <- make_plot_wrapper("continuous") 42 | combo_fn <- make_plot_wrapper("combo") 43 | discrete_fn <- make_plot_wrapper("discrete") 44 | continuous_diag_fn <- make_diag_plot_wrapper("continuous") 45 | discrete_diag_fn <- make_diag_plot_wrapper("discrete") 46 | 47 | function(type) { 48 | switch( 49 | type, 50 | "na" = na_fn, 51 | "na-diag" = na_diag_fn, 52 | "continuous" = continuous_fn, 53 | "combo" = combo_fn, 54 | "discrete" = discrete_fn, 55 | "continuous-diag" = continuous_diag_fn, 56 | "discrete-diag" = discrete_diag_fn, 57 | "label" = make_label_plot 58 | ) 59 | } 60 | })() 61 | -------------------------------------------------------------------------------- /.helper_functions: -------------------------------------------------------------------------------- 1 | covr_shiny_app: 2 | cov <- covr::package_coverage() 3 | covr::shine(cov) 4 | covr_zero_coverage: 5 | zero <- function(...) { 6 | # check out the link below to work most efficiently 7 | # https://codecov.io/github/ggobi/ggally/features/suggestions?ref=dev 8 | cov <- covr::package_coverage(...) 9 | covr::zero_coverage(cov) 10 | } 11 | zero() 12 | lintr_package: 13 | # remove line in "linters:" above 14 | devtools::lint() 15 | # fix errors, 16 | # repeat until no errors 17 | lintr_code_to_create_lintr: 18 | library(magrittr) 19 | library(dplyr) 20 | lintr::lint_package() %>% 21 | as.data.frame %>% 22 | group_by(linter) %>% 23 | tally(sort = TRUE) %$% 24 | sprintf("linters: with_defaults(\n %s\n NULL\n )\n", 25 | paste0(linter, " = NULL, # ", n, collapse="\n ")) %>% 26 | cat() 27 | test_package: 28 | tp <- function(package = "./", ...) { 29 | devtools::document(package) 30 | devtools::test(package, ...) 31 | } 32 | tp() 33 | test_file: 34 | tf <- function(file = "gg-plots", package = "./", spacer = "-") { 35 | devtools::load_all(package) 36 | testthat::test_file(file.path(package, "tests", "testthat", paste0("test", spacer, file, ".R"))) 37 | } 38 | tf("zzz_ggpairs") 39 | knit_vignettes: 40 | devtools::document(); packagedocs::build_vignettes() 41 | build_win: 42 | devtools::build_win(version = c("R-release", "R-devel")) 43 | reverse_depends: 44 | # revdepcheck::revdep_reset() 45 | revdepcheck::revdep_check(num_workers = 4, timeout = as.difftime(30, units = "mins"), quiet = FALSE) 46 | reverse_depends_email: 47 | devtools:::revdep_email(date = "Nov 4th alongside ggplot2's release", version = "1.3.0", author = "Barret", draft = TRUE, only_problems = FALSE) 48 | -------------------------------------------------------------------------------- /man/nba_ppg_2008.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-nba_ppg_2008.R 3 | \docType{data} 4 | \name{nba_ppg_2008} 5 | \alias{nba_ppg_2008} 6 | \title{NBA Player Statistics for 2008-2009 Season} 7 | \format{ 8 | A data frame with 50 rows and 21 variables 9 | } 10 | \source{ 11 | Data originally collected from FlowingData tutorial 12 | } 13 | \usage{ 14 | data(nba_ppg_2008) 15 | } 16 | \description{ 17 | This dataset contains performance statistics for NBA players from the 2008-2009 season. 18 | The data includes top-performing players with their scoring averages and various 19 | basketball performance metrics. 20 | } 21 | \details{ 22 | The dataset contains the following variables: 23 | \itemize{ 24 | \item Name - Player name 25 | \item G - Games played 26 | \item MIN - Minutes per game 27 | \item PTS - Points per game 28 | \item FGM - Field goals made per game 29 | \item FGA - Field goal attempts per game 30 | \item FGP - Field goal percentage 31 | \item FTM - Free throws made per game 32 | \item FTA - Free throw attempts per game 33 | \item FTP - Free throw percentage 34 | \item X3PM - Three-point field goals made per game 35 | \item X3PA - Three-point field goal attempts per game 36 | \item X3PP - Three-point field goal percentage 37 | \item ORB - Offensive rebounds per game 38 | \item DRB - Defensive rebounds per game 39 | \item TRB - Total rebounds per game 40 | \item AST - Assists per game 41 | \item STL - Steals per game 42 | \item BLK - Blocks per game 43 | \item TO - Turnovers per game 44 | \item PF - Personal fouls per game 45 | } 46 | } 47 | \references{ 48 | FlowingData (2010) How to Make a Heatmap - a Quick and Easy Solution. 49 | \url{https://flowingdata.com/2010/01/21/how-to-make-a-heatmap-a-quick-and-easy-solution/} 50 | } 51 | \keyword{datasets} 52 | -------------------------------------------------------------------------------- /tests/testthat/test-ggmatrix_add.R: -------------------------------------------------------------------------------- 1 | data(tips) 2 | 3 | test_that("add", { 4 | pm <- ggpairs(tips) 5 | 6 | expect_true(is.null(pm$title)) 7 | expect_true(is.null(pm$xlab)) 8 | expect_true(is.null(pm$ylab)) 9 | pm1 <- pm + labs(title = "my title", x = "x label", y = "y label") 10 | expect_equal(pm1$title, "my title") 11 | expect_equal(pm1$xlab, "x label") 12 | expect_equal(pm1$ylab, "y label") 13 | 14 | expect_true(is.null(pm$gg)) 15 | 16 | # first add 17 | pm2 <- pm + ggplot2::theme_bw() 18 | expect_true(!is.null(pm2$gg)) 19 | 20 | # second to nth add 21 | pm3 <- pm + ggplot2::theme_bw() 22 | expect_true(!is.null(pm3$gg)) 23 | 24 | # bad add 25 | expect_snapshot(pm + 3, error = TRUE) 26 | 27 | # adding scale 28 | pm4 <- pm + ggplot2::scale_fill_brewer() 29 | expect_false(identical(pm$plots[[1]], pm4$plots[[1]])) 30 | expect_false(identical(pm$plots[[2]], pm4$plots[[2]])) 31 | 32 | # change only some subplots 33 | pm5 <- add_to_ggmatrix(pm, ggplot2::coord_equal(), cols = 1) 34 | expect_false(identical(pm$plots[[1]], pm5$plots[[1]])) 35 | expect_true(identical(pm$plots[[2]], pm5$plots[[2]])) 36 | }) 37 | 38 | 39 | test_that("add_list", { 40 | pm <- ggpairs(tips, 1:2) 41 | 42 | pm1 <- pm + 43 | list( 44 | ggplot2::labs(x = "x title"), 45 | ggplot2::labs(title = "list title") 46 | ) 47 | 48 | expect_equal(pm1$xlab, "x title") 49 | expect_equal(pm1$title, "list title") 50 | }) 51 | 52 | test_that("v1_ggmatrix_theme", { 53 | old_opts <- options(lifecycle_verbosity = "quiet") 54 | on.exit(options(old_opts), add = TRUE) 55 | 56 | expect_snapshot( 57 | { 58 | pm <- ggpairs(tips, 1:2) 59 | 60 | pm1 <- pm + v1_ggmatrix_theme() 61 | 62 | expect_true(is.null(pm$gg)) 63 | expect_true(!is.null(pm1$gg)) 64 | } 65 | ) 66 | }) 67 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/wrap.md: -------------------------------------------------------------------------------- 1 | # errors 2 | 3 | Code 4 | wrap(fn, NA) 5 | Condition 6 | Error in `wrap()`: 7 | ! all parameters must be named arguments 8 | 9 | --- 10 | 11 | Code 12 | wrap(fn, y = TRUE, 5) 13 | Condition 14 | Error in `wrap()`: 15 | ! all parameters must be named arguments 16 | 17 | --- 18 | 19 | Code 20 | wrapp(fn, list(5)) 21 | Condition 22 | Error in `wrapp()`: 23 | ! `params` must be a named list, named vector, or "NULL". 24 | 25 | --- 26 | 27 | Code 28 | wrapp(fn, table(1:10, 1:10)) 29 | Condition 30 | Error in `wrapp()`: 31 | ! `params` must be a named list, named vector, or "NULL". 32 | 33 | --- 34 | 35 | Code 36 | wrapp(fn, list(A = 4, 5)) 37 | Condition 38 | Error in `wrapp()`: 39 | ! `params` must be a named list, named vector, or "NULL". 40 | 41 | --- 42 | 43 | Code 44 | wrap("does not exist", A = 5) 45 | Condition 46 | Error in `value[[3L]]()`: 47 | ! Error retrieving `GGally` function. 48 | Please provide a string such as "points" for `ggally_points()` 49 | For a list of all predefined functions, check out `vig_ggally("ggally_plots")` 50 | A custom function may be supplied directly: `wrap(my_fn, param = val)` 51 | Function provided: `does not exist()` 52 | 53 | --- 54 | 55 | Code 56 | wrapp("does not exist", list(A = 5)) 57 | Condition 58 | Error in `value[[3L]]()`: 59 | ! Error retrieving `GGally` function. 60 | Please provide a string such as "points" for `ggally_points()` 61 | For a list of all predefined functions, check out `vig_ggally("ggally_plots")` 62 | A custom function may be supplied directly: `wrap(my_fn, param = val)` 63 | Function provided: `does not exist()` 64 | 65 | -------------------------------------------------------------------------------- /man/gglegend.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggmatrix_legend.R 3 | \name{gglegend} 4 | \alias{gglegend} 5 | \title{Plot only legend of plot function} 6 | \usage{ 7 | gglegend(fn) 8 | } 9 | \arguments{ 10 | \item{fn}{this value is passed directly to an empty \code{\link{wrap}} call. Please see \code{?\link{wrap}} for more details.} 11 | } 12 | \value{ 13 | a function that when called with arguments will produce the legend of the plotting function supplied. 14 | } 15 | \description{ 16 | Plot only legend of plot function 17 | } 18 | \examples{ 19 | # Small function to display plots only if it's interactive 20 | p_ <- GGally::print_if_interactive 21 | 22 | # display regular plot 23 | p_(ggally_points(iris, ggplot2::aes(Sepal.Length, Sepal.Width, color = Species))) 24 | 25 | # Make a function that will only print the legend 26 | points_legend <- gglegend(ggally_points) 27 | p_(points_legend(iris, ggplot2::aes(Sepal.Length, Sepal.Width, color = Species))) 28 | 29 | # produce the sample legend plot, but supply a string that 'wrap' understands 30 | same_points_legend <- gglegend("points") 31 | identical( 32 | attr(attr(points_legend, "fn"), "original_fn"), 33 | attr(attr(same_points_legend, "fn"), "original_fn") 34 | ) 35 | 36 | # Complicated examples 37 | custom_legend <- wrap(gglegend("points"), size = 6) 38 | p_(custom_legend(iris, ggplot2::aes(Sepal.Length, Sepal.Width, color = Species))) 39 | 40 | # Use within ggpairs 41 | pm <- ggpairs( 42 | iris, 1:2, 43 | mapping = ggplot2::aes(color = Species), 44 | upper = list(continuous = gglegend("points")) 45 | ) 46 | p_(pm) 47 | 48 | # Place a legend in a specific location 49 | pm <- ggpairs(iris, 1:2, mapping = ggplot2::aes(color = Species)) 50 | # Make the legend 51 | pm[1, 2] <- points_legend(iris, ggplot2::aes(Sepal.Width, Sepal.Length, color = Species)) 52 | p_(pm) 53 | } 54 | -------------------------------------------------------------------------------- /R/ggmatrix_progress.R: -------------------------------------------------------------------------------- 1 | #' \code{\link{ggmatrix}} default progress bar 2 | #' 3 | #' @param format,clear,show_after,... parameters supplied directly to \code{progress::\link[progress]{progress_bar}$new()} 4 | #' @return function that accepts a plot matrix as the first argument and \code{...} for future expansion. Internally, the plot matrix is used to determine the total number of plots for the progress bar. 5 | #' @export 6 | #' @examples 7 | #' p_ <- GGally::print_if_interactive 8 | #' 9 | #' pm <- ggpairs(iris, 1:2, progress = ggmatrix_progress()) 10 | #' p_(pm) 11 | #' 12 | #' # does not clear after finishing 13 | #' pm <- ggpairs(iris, 1:2, progress = ggmatrix_progress(clear = FALSE)) 14 | #' p_(pm) 15 | ggmatrix_progress <- function( 16 | format = " plot: [:plot_i, :plot_j] [:bar]:percent est::eta ", 17 | clear = TRUE, 18 | show_after = 0, 19 | ... 20 | ) { 21 | ret <- function(pm, ...) { 22 | progress::progress_bar$new( 23 | format = format, 24 | clear = clear, 25 | show_after = show_after, 26 | total = pm$ncol * pm$nrow, 27 | ... 28 | ) 29 | } 30 | 31 | ret 32 | } 33 | 34 | 35 | as_ggmatrix_progress <- function(x, total, ...) { 36 | if (isFALSE(x)) { 37 | return(FALSE) 38 | } 39 | if (isTRUE(x)) { 40 | return(ggmatrix_progress(...)) 41 | } 42 | if (is.null(x)) { 43 | shouldDisplay <- interactive() && total > 15 44 | if (!shouldDisplay) { 45 | return(FALSE) 46 | } else { 47 | return(ggmatrix_progress(...)) 48 | } 49 | } 50 | if (is.function(x)) { 51 | return(x) 52 | } 53 | 54 | cli::cli_abort(c( 55 | "{.fn as_ggmatrix_progress} only knows how to handle {.code TRUE}, {.code FALSE}, {.code NULL}, or a function.", 56 | i = "If a function, it must return a new {.fn progress::progress_bar}." 57 | )) 58 | } 59 | 60 | isFALSE <- function(x) { 61 | identical(FALSE, x) 62 | } 63 | -------------------------------------------------------------------------------- /R/data-happy.R: -------------------------------------------------------------------------------- 1 | #' Data related to happiness from the General Social Survey, 1972-2006. 2 | #' 3 | #' This data extract is taken from Hadley Wickham's \code{productplots} package. 4 | #' The original description follows, with minor edits. 5 | #' 6 | #' The data is a small sample of variables related to 7 | #' happiness from the General Social Survey (GSS). The GSS 8 | #' is a yearly cross-sectional survey of Americans, run from 9 | #' 1972. We combine data for 25 years to yield 51,020 10 | #' observations, and of the over 5,000 variables, we select 11 | #' nine related to happiness: 12 | #' 13 | #' @details \itemize{ 14 | #' \item age. age in years: 18--89. 15 | #' \item degree. highest education: lt high school, high school, junior college, bachelor, graduate. 16 | #' \item finrela. relative financial status: far above, above average, average, below average, far below. 17 | #' \item happy. happiness: very happy, pretty happy, not too happy. 18 | #' \item health. health: excellent, good, fair, poor. 19 | #' \item marital. marital status: married, never married, divorced, widowed, separated. 20 | #' \item sex. sex: female, male. 21 | #' \item wtsall. probability weight. 0.43--6.43. 22 | #' } 23 | #' 24 | #' @docType data 25 | #' @keywords datasets 26 | #' @name happy 27 | #' @usage data(happy) 28 | #' @format A data frame with 51020 rows and 10 variables 29 | #' @references 30 | #' Smith, Tom W., Peter V. Marsden, Michael Hout, Jibum Kim. \emph{General Social Surveys, 1972-2006}. 31 | #' \[machine-readable data file\]. Principal Investigator, Tom W. Smith; Co-Principal Investigators, 32 | #' Peter V. Marsden and Michael Hout, NORC ed. 33 | #' Chicago: National Opinion Research Center, producer, 2005; 34 | #' Storrs, CT: The Roper Center for Public Opinion Research, University of Connecticut, distributor. 35 | #' 1 data file (57,061 logical records) and 1 codebook (3,422 pp). 36 | NULL 37 | -------------------------------------------------------------------------------- /notes/correlation.R: -------------------------------------------------------------------------------- 1 | ggpairs(tips, columns = 1:2, params = c(corMethod = "pearson")) 2 | ggpairs(tips, columns = 1:2, params = c(corMethod = "kendall")) 3 | ggpairs(tips, columns = 1:2, params = c(corMethod = "pearson"), color = "sex") 4 | ggpairs(tips, columns = 1:2, params = c(corMethod = "kendall"), color = "sex") 5 | 6 | ggpairs(tips, columns = 1:2, upper = list(params = list(corMethod = "kendall"))) 7 | ggpairs(tips, columns = 1:2, upper = list(params = list(corMethod = "pearson"))) 8 | ggpairs( 9 | tips, 10 | columns = 1:2, 11 | upper = list(params = list(corMethod = "pearson")), 12 | color = "sex" 13 | ) 14 | ggpairs( 15 | tips, 16 | columns = 1:2, 17 | upper = list(params = list(corMethod = "kendall")), 18 | color = "sex" 19 | ) 20 | 21 | 22 | swM <- swiss 23 | colnames(swM) <- abbreviate(colnames(swiss), min = 6) 24 | swM[1, 2] <- swM[7, 3] <- swM[25, 5] <- NA # create 3 "missing" 25 | ## Consider all 5 "use" cases : 26 | (C. <- cov(swM)) # use="everything" quite a few NA's in cov.matrix 27 | try(cov(swM, use = "all")) # Error: missing obs... 28 | (C2 <- cov(swM, use = "complete")) 29 | stopifnot(identical(C2, cov(swM, use = "na.or.complete"))) 30 | range(eigen(C2, only.values = TRUE)$values) # 6.46 1930 31 | (C3 <- cov(swM, use = "pairwise")) 32 | range(eigen(C3, only.values = TRUE)$values) # 6.19 1938 33 | 34 | 35 | # using full data 36 | cor(mtcars[, 1:3], method = "kendall", use = "complete")[2, 3] 37 | 0.7915213 38 | cor(mtcars[, 1:3], method = "kendall", use = "pairwise")[2, 3] # matches below 39 | cor(mtcars[, 1:3], method = "kendall", use = "na.or")[2, 3] 40 | 41 | # only two columns 42 | cor(mtcars$cyl, mtcars$disp, method = "kendall", use = "complete") 43 | cor(mtcars$cyl, mtcars$disp, method = "kendall", use = "pairwise") 44 | cor(mtcars$cyl, mtcars$disp, method = "kendall", use = "na.or") 45 | 46 | 47 | ggally_cor(mtcars, aes(cyl, disp), corMethod = "kendall", use = "complete.obs") 48 | -------------------------------------------------------------------------------- /R/ggmatrix_print.R: -------------------------------------------------------------------------------- 1 | #' @include ggmatrix.R 2 | NULL 3 | 4 | ggplot2_set_last_plot <- utils::getFromNamespace("set_last_plot", "ggplot2") 5 | 6 | #' Print \code{\link{ggmatrix}} object 7 | #' 8 | #' Print method taken from \code{ggplot2:::print.ggplot} and altered for a \code{\link{ggmatrix}} object 9 | #' 10 | #' @param x plot to display 11 | #' @param newpage draw new (empty) page first? 12 | #' @param vp viewport to draw plot in 13 | #' @param ... arguments passed onto \code{\link{ggmatrix_gtable}} 14 | #' @author Barret Schloerke 15 | #' @import utils 16 | #' @importFrom grid grid.newpage grid.draw seekViewport pushViewport upViewport 17 | # ' @export 18 | #' @name print.ggmatrix 19 | #' @examples 20 | #' data(tips) 21 | #' pMat <- ggpairs(tips, c(1, 3, 2), mapping = ggplot2::aes(color = sex)) 22 | #' pMat # calls print(pMat), which calls print.ggmatrix(pMat) 23 | method(print, ggmatrix) <- function(x, newpage = TRUE, vp = NULL, ...) { 24 | if (newpage) { 25 | grid.newpage() 26 | } 27 | grDevices::recordGraphics( 28 | requireNamespace("GGally", quietly = TRUE), 29 | list(), 30 | getNamespace("GGally") 31 | ) 32 | gtable <- ggmatrix_gtable(x, ...) 33 | 34 | # must be done after gtable, as gtable calls many ggplot2::print.ggplot methods 35 | ggplot2_set_last_plot(x) 36 | 37 | if (is.null(vp)) { 38 | grid.draw(gtable) 39 | } else { 40 | if (is.character(vp)) { 41 | seekViewport(vp) 42 | } else { 43 | pushViewport(vp) 44 | } 45 | grid.draw(gtable) 46 | upViewport() 47 | } 48 | invisible(data) 49 | } 50 | 51 | 52 | #' Is Blank Plot? 53 | #' Find out if the plot equals a blank plot 54 | #' 55 | #' @keywords internal 56 | #' @examples 57 | #' GGally:::is_blank_plot(ggally_blank()) 58 | #' GGally:::is_blank_plot(ggally_points(mtcars, ggplot2::aes(disp, hp))) 59 | #' 60 | is_blank_plot <- function(p) { 61 | is.null(p) || identical(p, "blank") || inherits(p, "ggmatrix_blank") 62 | } 63 | -------------------------------------------------------------------------------- /man/happy.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-happy.R 3 | \docType{data} 4 | \name{happy} 5 | \alias{happy} 6 | \title{Data related to happiness from the General Social Survey, 1972-2006.} 7 | \format{ 8 | A data frame with 51020 rows and 10 variables 9 | } 10 | \usage{ 11 | data(happy) 12 | } 13 | \description{ 14 | This data extract is taken from Hadley Wickham's \code{productplots} package. 15 | The original description follows, with minor edits. 16 | } 17 | \details{ 18 | The data is a small sample of variables related to 19 | happiness from the General Social Survey (GSS). The GSS 20 | is a yearly cross-sectional survey of Americans, run from 21 | 1972. We combine data for 25 years to yield 51,020 22 | observations, and of the over 5,000 variables, we select 23 | nine related to happiness: 24 | 25 | \itemize{ 26 | \item age. age in years: 18--89. 27 | \item degree. highest education: lt high school, high school, junior college, bachelor, graduate. 28 | \item finrela. relative financial status: far above, above average, average, below average, far below. 29 | \item happy. happiness: very happy, pretty happy, not too happy. 30 | \item health. health: excellent, good, fair, poor. 31 | \item marital. marital status: married, never married, divorced, widowed, separated. 32 | \item sex. sex: female, male. 33 | \item wtsall. probability weight. 0.43--6.43. 34 | } 35 | } 36 | \references{ 37 | Smith, Tom W., Peter V. Marsden, Michael Hout, Jibum Kim. \emph{General Social Surveys, 1972-2006}. 38 | [machine-readable data file]. Principal Investigator, Tom W. Smith; Co-Principal Investigators, 39 | Peter V. Marsden and Michael Hout, NORC ed. 40 | Chicago: National Opinion Research Center, producer, 2005; 41 | Storrs, CT: The Roper Center for Public Opinion Research, University of Connecticut, distributor. 42 | 1 data file (57,061 logical records) and 1 codebook (3,422 pp). 43 | } 44 | \keyword{datasets} 45 | -------------------------------------------------------------------------------- /man/GGally-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/GGally-package.R 3 | \docType{package} 4 | \name{GGally-package} 5 | \alias{GGally} 6 | \alias{GGally-package} 7 | \title{GGally: Extension to 'ggplot2'} 8 | \description{ 9 | The R package 'ggplot2' is a plotting system based on the grammar of graphics. 'GGally' extends 'ggplot2' by adding several functions to reduce the complexity of combining geometric objects with transformed data. Some of these functions include a pairwise plot matrix, a two group pairwise plot matrix, a parallel coordinates plot, a survival plot, and several functions to plot networks. 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://ggobi.github.io/ggally/} 15 | \item \url{https://github.com/ggobi/ggally} 16 | \item Report bugs at \url{https://github.com/ggobi/ggally/issues} 17 | } 18 | 19 | } 20 | \author{ 21 | \strong{Maintainer}: Barret Schloerke \email{schloerke@gmail.com} (\href{https://orcid.org/0000-0001-9986-114X}{ORCID}) 22 | 23 | Authors: 24 | \itemize{ 25 | \item Di Cook \email{dicook@monash.edu} (\href{https://orcid.org/0000-0002-3813-7155}{ORCID}) [thesis advisor] 26 | \item Joseph Larmarange \email{joseph@larmarange.net} (\href{https://orcid.org/0000-0001-7097-700X}{ORCID}) 27 | \item Francois Briatte \email{f.briatte@gmail.com} 28 | \item Moritz Marbach \email{mmarbach@mail.uni-mannheim.de} 29 | \item Edwin Thoen \email{edwinthoen@gmail.com} 30 | \item Amos Elberg \email{amos.elberg@gmail.com} 31 | \item Jason Crowley \email{crowley.jason.s@gmail.com} 32 | } 33 | 34 | Other contributors: 35 | \itemize{ 36 | \item Ott Toomet \email{otoomet@gmail.com} [contributor] 37 | \item Heike Hofmann \email{hhofmann4@unl.edu} (\href{https://orcid.org/0000-0001-6216-5183}{ORCID}) [thesis advisor] 38 | \item Hadley Wickham \email{h.wickham@gmail.com} (\href{https://orcid.org/0000-0003-4757-117X}{ORCID}) [thesis advisor] 39 | } 40 | 41 | } 42 | \keyword{internal} 43 | -------------------------------------------------------------------------------- /man/ggally_nostic_resid.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{ggally_nostic_resid} 4 | \alias{ggally_nostic_resid} 5 | \title{\code{\link{ggnostic}} residuals} 6 | \usage{ 7 | ggally_nostic_resid( 8 | data, 9 | mapping, 10 | ..., 11 | linePosition = 0, 12 | lineColor = brew_colors("grey"), 13 | lineSize = 0.5, 14 | lineAlpha = 1, 15 | lineType = 1, 16 | lineConfColor = brew_colors("grey"), 17 | lineConfSize = lineSize, 18 | lineConfAlpha = lineAlpha, 19 | lineConfType = 2, 20 | pVal = c(0.025, 0.975), 21 | sigma = attr(data, "broom_glance")$sigma, 22 | se = TRUE, 23 | method = "auto", 24 | formula = y ~ x 25 | ) 26 | } 27 | \arguments{ 28 | \item{data, mapping, ...}{parameters supplied to \code{\link{ggally_nostic_line}}} 29 | 30 | \item{linePosition, lineColor, lineSize, lineAlpha, lineType}{parameters supplied to 31 | \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}}} 32 | 33 | \item{lineConfColor, lineConfSize, lineConfAlpha, lineConfType}{parameters supplied to the 34 | confidence interval lines} 35 | 36 | \item{pVal}{percentiles of a N(0, sigma) distribution to be drawn} 37 | 38 | \item{sigma}{sigma value for the \code{pVal} percentiles} 39 | 40 | \item{se}{boolean to determine if the confidence intervals should be displayed} 41 | 42 | \item{method, formula}{parameters supplied to \code{\link[ggplot2:geom_smooth]{ggplot2::geom_smooth()}}. 43 | Defaults to \code{"auto"} and \code{"y ~ x"}} 44 | } 45 | \value{ 46 | \pkg{ggplot2} plot object 47 | } 48 | \description{ 49 | If non-null \code{pVal} and \code{sigma} values are given, confidence interval lines will be added to the plot at the specified \code{pVal} percentiles of a N(0, sigma) distribution. 50 | } 51 | \examples{ 52 | # Small function to display plots only if it's interactive 53 | p_ <- GGally::print_if_interactive 54 | 55 | dt <- broomify(stats::lm(mpg ~ wt + qsec + am, data = mtcars)) 56 | p_(ggally_nostic_resid(dt, ggplot2::aes(wt, .resid))) 57 | } 58 | \seealso{ 59 | \code{stats::\link[stats]{residuals}} 60 | } 61 | -------------------------------------------------------------------------------- /man/ggtable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggtable.R 3 | \name{ggtable} 4 | \alias{ggtable} 5 | \title{Cross-tabulated tables of discrete variables} 6 | \usage{ 7 | ggtable( 8 | data, 9 | columnsX = 1:ncol(data), 10 | columnsY = 1:ncol(data), 11 | cells = c("observed", "prop", "row.prop", "col.prop", "expected", "resid", "std.resid"), 12 | fill = c("none", "std.resid", "resid"), 13 | mapping = NULL, 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{data}{dataset to be used, can have both categorical and 19 | numerical variables} 20 | 21 | \item{columnsX, columnsY}{names or positions of which columns are used to make plots. Defaults to all columns.} 22 | 23 | \item{cells}{Which statistic should be displayed in table cells?} 24 | 25 | \item{fill}{Which statistic should be used for filling table cells?} 26 | 27 | \item{mapping}{additional aesthetic to be used, for example to indicate 28 | weights (see examples)} 29 | 30 | \item{...}{additional arguments passed to \code{\link{ggduo}} (see examples)} 31 | } 32 | \description{ 33 | \code{ggtable} is a variant of \code{\link{ggduo}} for quick 34 | cross-tabulated tables of discrete variables. 35 | } 36 | \examples{ 37 | # small function to display plots only if it's interactive 38 | p_ <- GGally::print_if_interactive 39 | 40 | data(tips) 41 | p_(ggtable(tips, "smoker", c("day", "time", "sex"))) 42 | 43 | # displaying row proportions 44 | p_(ggtable(tips, "smoker", c("day", "time", "sex"), cells = "row.prop")) 45 | 46 | # filling cells with standardized residuals 47 | p_(ggtable(tips, "smoker", c("day", "time", "sex"), fill = "std.resid", legend = 1)) 48 | 49 | # if continuous variables are provided, just displaying some summary statistics 50 | p_(ggtable(tips, c("smoker", "total_bill"), c("day", "time", "sex", "tip"))) 51 | 52 | # specifying weights 53 | d <- as.data.frame(Titanic) 54 | p_(ggtable( 55 | d, 56 | "Survived", 57 | c("Class", "Sex", "Age"), 58 | mapping = aes(weight = Freq), 59 | cells = "row.prop", 60 | fill = "std.resid" 61 | )) 62 | } 63 | \author{ 64 | Joseph Larmarange 65 | } 66 | -------------------------------------------------------------------------------- /man/glyphs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gglyph.R 3 | \name{glyphs} 4 | \alias{glyphs} 5 | \title{Create \code{\link{glyphplot}} data} 6 | \usage{ 7 | glyphs( 8 | data, 9 | x_major, 10 | x_minor, 11 | y_major, 12 | y_minor, 13 | polar = FALSE, 14 | height = ggplot2::rel(0.95), 15 | width = ggplot2::rel(0.95), 16 | y_scale = identity, 17 | x_scale = identity 18 | ) 19 | } 20 | \arguments{ 21 | \item{data}{A data frame containing variables named in \code{x_major}, 22 | \code{x_minor}, \code{y_major} and \code{y_minor}.} 23 | 24 | \item{x_major, x_minor, y_major, y_minor}{The name of the variable (as a 25 | string) for the major and minor x and y axes. Together, each unique} 26 | 27 | \item{polar}{A logical of length 1, specifying whether the glyphs should 28 | be drawn in polar coordinates. Defaults to \code{FALSE}.} 29 | 30 | \item{height, width}{The height and width of each glyph. Defaults to 95\% of 31 | the \code{\link[ggplot2]{resolution}} of the data. Specify the width 32 | absolutely by supplying a numeric vector of length 1, or relative to the} 33 | 34 | \item{y_scale, x_scale}{The scaling function to be applied to each set of 35 | minor values within a grid cell. Defaults to \code{\link{identity}} so 36 | that no scaling is performed.} 37 | } 38 | \description{ 39 | Create the data needed to generate a glyph plot. 40 | } 41 | \examples{ 42 | # Small function to display plots only if it's interactive 43 | p_ <- GGally::print_if_interactive 44 | 45 | data(nasa) 46 | nasaLate <- nasa[ 47 | nasa$date >= as.POSIXct("1998-01-01") & 48 | nasa$lat >= 20 & 49 | nasa$lat <= 40 & 50 | nasa$long >= -80 & 51 | nasa$long <= -60, 52 | ] 53 | temp.gly <- glyphs(nasaLate, "long", "day", "lat", "surftemp", height = 2.5) 54 | p_(ggplot2::ggplot(temp.gly, ggplot2::aes(gx, gy, group = gid)) + 55 | add_ref_lines(temp.gly, color = "grey90") + 56 | add_ref_boxes(temp.gly, color = "grey90") + 57 | ggplot2::geom_path() + 58 | ggplot2::theme_bw() + 59 | ggplot2::labs(x = "", y = "")) 60 | } 61 | \author{ 62 | Di Cook, Heike Hofmann, Hadley Wickham 63 | } 64 | -------------------------------------------------------------------------------- /man/ggally_trends.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggaly_trends.R 3 | \name{ggally_trends} 4 | \alias{ggally_trends} 5 | \title{Trends line plot} 6 | \usage{ 7 | ggally_trends(data, mapping, ..., include_zero = FALSE) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{other arguments passed to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}}} 15 | 16 | \item{include_zero}{Should 0 be included on the y-axis?} 17 | } 18 | \description{ 19 | Plot trends using line plots. 20 | For continuous y variables, plot the evolution of the mean. 21 | For binary y variables, plot the evolution of the proportion. 22 | } 23 | \examples{ 24 | # Small function to display plots only if it's interactive 25 | p_ <- GGally::print_if_interactive 26 | 27 | data(tips) 28 | tips_f <- tips 29 | tips_f$day <- factor(tips$day, c("Thur", "Fri", "Sat", "Sun")) 30 | 31 | # Numeric variable 32 | p_(ggally_trends(tips_f, mapping = aes(x = day, y = total_bill))) 33 | p_(ggally_trends(tips_f, mapping = aes(x = day, y = total_bill, colour = time))) 34 | 35 | # Binary variable 36 | p_(ggally_trends(tips_f, mapping = aes(x = day, y = smoker))) 37 | p_(ggally_trends(tips_f, mapping = aes(x = day, y = smoker, colour = sex))) 38 | 39 | # Discrete variable with 3 or more categories 40 | p_(ggally_trends(tips_f, mapping = aes(x = smoker, y = day))) 41 | p_(ggally_trends(tips_f, mapping = aes(x = smoker, y = day, color = sex))) 42 | 43 | # Include zero on Y axis 44 | p_(ggally_trends(tips_f, mapping = aes(x = day, y = total_bill), include_zero = TRUE)) 45 | p_(ggally_trends(tips_f, mapping = aes(x = day, y = smoker), include_zero = TRUE)) 46 | 47 | # Change line size 48 | p_(ggally_trends(tips_f, mapping = aes(x = day, y = smoker, colour = sex), size = 3)) 49 | 50 | # Define weights with the appropriate aesthetic 51 | d <- as.data.frame(Titanic) 52 | p_(ggally_trends( 53 | d, 54 | mapping = aes(x = Class, y = Survived, weight = Freq, color = Sex), 55 | include_zero = TRUE 56 | )) 57 | } 58 | \author{ 59 | Joseph Larmarange 60 | } 61 | \keyword{hplot} 62 | -------------------------------------------------------------------------------- /man/ggally_nostic_hat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnostic.R 3 | \name{ggally_nostic_hat} 4 | \alias{ggally_nostic_hat} 5 | \title{\code{\link{ggnostic}} leverage points} 6 | \usage{ 7 | ggally_nostic_hat( 8 | data, 9 | mapping, 10 | ..., 11 | linePosition = 2 * sum(eval_data_col(data, mapping$y))/nrow(data), 12 | lineColor = brew_colors("grey"), 13 | lineSize = 0.5, 14 | lineAlpha = 1, 15 | lineType = 2, 16 | avgLinePosition = sum(eval_data_col(data, mapping$y))/nrow(data), 17 | avgLineColor = brew_colors("grey"), 18 | avgLineSize = lineSize, 19 | avgLineAlpha = lineAlpha, 20 | avgLineType = 1 21 | ) 22 | } 23 | \arguments{ 24 | \item{data, mapping, ...}{supplied directly to \code{\link{ggally_nostic_line}}} 25 | 26 | \item{linePosition, lineColor, lineSize, lineAlpha, lineType}{parameters supplied to 27 | \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}} for the cutoff line} 28 | 29 | \item{avgLinePosition, avgLineColor, avgLineSize, avgLineAlpha, avgLineType}{parameters supplied 30 | to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}} for the average line} 31 | } 32 | \value{ 33 | \pkg{ggplot2} plot object 34 | } 35 | \description{ 36 | A function to display stats::influence's hat information against a given explanatory variable. 37 | } 38 | \details{ 39 | As stated in \code{\link[stats:lm.influence]{stats::influence()}} documentation: 40 | 41 | hat: a vector containing the diagonal of the 'hat' matrix. 42 | 43 | The diagonal elements of the 'hat' matrix describe the influence each response value has on the fitted value for that same observation. 44 | 45 | A suggested "cutoff" line is added to the plot at a height of 2 * p / n and an expected line at a height of p / n. 46 | If either \code{linePosition} or \code{avgLinePosition} is \code{NULL}, the respective line will not be drawn. 47 | } 48 | \examples{ 49 | # Small function to display plots only if it's interactive 50 | p_ <- GGally::print_if_interactive 51 | 52 | dt <- broomify(stats::lm(mpg ~ wt + qsec + am, data = mtcars)) 53 | p_(ggally_nostic_hat(dt, ggplot2::aes(wt, .hat))) 54 | } 55 | \seealso{ 56 | \code{\link[stats:lm.influence]{stats::influence()}} 57 | } 58 | -------------------------------------------------------------------------------- /inst/WORDLIST: -------------------------------------------------------------------------------- 1 | AST 2 | Aes 3 | BLK 4 | Biometrics 5 | Broomify 6 | CMD 7 | ColorBrewer 8 | DRB 9 | Environmetrics 10 | FGA 11 | FGM 12 | FGP 13 | FTA 14 | FTM 15 | FlowingData 16 | Fruchterman 17 | GSS 18 | Gb 19 | Heptapot 20 | Herzberg 21 | Homewood 22 | Hout 23 | JSM 24 | Jibum 25 | Jordano 26 | Kaplan 27 | Kutner 28 | Liu 29 | Lubischew 30 | Marsden 31 | McGraw 32 | Mengjia 33 | Murrell 34 | NORC 35 | Nachtsheim 36 | Neter 37 | ORCID 38 | Opsahl 39 | PTS 40 | PV 41 | Programme 42 | RColorBrewer 43 | RStudio 44 | Reingold 45 | SCIE 46 | SENWGT 47 | STL 48 | Springer 49 | Statlib 50 | Storrs 51 | Su's 52 | TRB 53 | Tian 54 | Wickham's 55 | Yau 56 | Yu 57 | Zheng 58 | aede 59 | aedeagus 60 | aes 61 | anova 62 | api 63 | axisLabels 64 | axisVars 65 | barDiag 66 | bb 67 | blankDiag 68 | broomify'ed 69 | centerObs 70 | ci 71 | cityServiceFirms 72 | cloudhigh 73 | cloudlow 74 | cloudmid 75 | cmu 76 | codebook 77 | colour 78 | colours 79 | concinna 80 | corMethod 81 | covr 82 | dae 83 | densityDiag 84 | df 85 | dfc 86 | diag 87 | directedness 88 | edu 89 | facet'ed 90 | fe 91 | finrela 92 | formatter 93 | geocoded 94 | geoms 95 | ggally 96 | ggbivariate 97 | ggcoef 98 | ggcorr 99 | ggduo 100 | ggfluctuation 101 | gglegend 102 | gglyph 103 | ggmap 104 | ggmatrix 105 | ggnet 106 | ggnetworkmap 107 | ggnostic 108 | ggpairs 109 | ggparcoord 110 | ggplot 111 | ggscatmat 112 | ggsurv 113 | ggtable 114 | gidp 115 | github 116 | glyphmap 117 | glyphplot 118 | grey 119 | gridlines 120 | hbp 121 | heikertingeri 122 | heptapotamica 123 | herdsz 124 | hjust 125 | http 126 | ibb 127 | ide 128 | idre 129 | igraph 130 | ing 131 | intergraph 132 | labelled 133 | labeller 134 | labellers 135 | linetype 136 | lintr 137 | lm 138 | loess 139 | lon 140 | lowertriangle 141 | lt 142 | magrittr 143 | na 144 | naDiag 145 | newpage 146 | num 147 | param 148 | parcoord 149 | plotmath 150 | preallocates 151 | rbi 152 | sb 153 | scagnostic 154 | scagnostics 155 | scaler 156 | se 157 | shadebox 158 | spambots 159 | stratums 160 | surftemp 161 | th 162 | tidiers 163 | travis 164 | truthy 165 | ucla 166 | univariately 167 | uppertriangle 168 | vjust 169 | wtsall 170 | www 171 | -------------------------------------------------------------------------------- /man/ggally_crosstable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggally_cross.R 3 | \name{ggally_crosstable} 4 | \alias{ggally_crosstable} 5 | \title{Display a cross-tabulated table} 6 | \usage{ 7 | ggally_crosstable( 8 | data, 9 | mapping, 10 | cells = c("observed", "prop", "row.prop", "col.prop", "expected", "resid", "std.resid"), 11 | fill = c("none", "std.resid", "resid"), 12 | ..., 13 | geom_tile_args = list(colour = "grey50") 14 | ) 15 | } 16 | \arguments{ 17 | \item{data}{data set using} 18 | 19 | \item{mapping}{aesthetics being used} 20 | 21 | \item{cells}{Which statistic should be displayed in table cells?} 22 | 23 | \item{fill}{Which statistic should be used for filling table cells?} 24 | 25 | \item{...}{other arguments passed to \code{\link[ggplot2]{geom_text}(...)}} 26 | 27 | \item{geom_tile_args}{other arguments passed to \code{\link[ggplot2]{geom_tile}(...)}} 28 | } 29 | \description{ 30 | \code{ggally_crosstable} is a variation of \code{\link{ggally_table}} with few modifications: (i) table cells are drawn; (ii) x and y axis are not expanded (and therefore are not aligned with other \code{ggally_*} plots); (iii) content and fill of cells can be easily controlled with dedicated arguments. 31 | } 32 | \examples{ 33 | # Small function to display plots only if it's interactive 34 | p_ <- GGally::print_if_interactive 35 | 36 | data(tips) 37 | 38 | # differences with ggally_table() 39 | p_(ggally_table(tips, mapping = aes(x = day, y = time))) 40 | p_(ggally_crosstable(tips, mapping = aes(x = day, y = time))) 41 | 42 | # display column proportions 43 | p_(ggally_crosstable(tips, mapping = aes(x = day, y = sex), cells = "col.prop")) 44 | 45 | # display row proportions 46 | p_(ggally_crosstable(tips, mapping = aes(x = day, y = sex), cells = "row.prop")) 47 | 48 | # change size of text 49 | p_(ggally_crosstable(tips, mapping = aes(x = day, y = sex), size = 8)) 50 | 51 | # fill cells with standardized residuals 52 | p_(ggally_crosstable(tips, mapping = aes(x = day, y = sex), fill = "std.resid")) 53 | 54 | # change scale for fill 55 | p_(ggally_crosstable(tips, mapping = aes(x = day, y = sex), fill = "std.resid") + 56 | scale_fill_steps2(breaks = c(-2, 0, 2), show.limits = TRUE)) 57 | } 58 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/gglegend/custom.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Species 23 | 24 | 25 | 26 | 27 | 28 | 29 | setosa 30 | versicolor 31 | virginica 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/gglegend/points.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Species 23 | 24 | 25 | 26 | 27 | 28 | 29 | setosa 30 | versicolor 31 | virginica 32 | 33 | 34 | -------------------------------------------------------------------------------- /man/ggally_cor_v1_5.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/deprecated.R 3 | \name{ggally_cor_v1_5} 4 | \alias{ggally_cor_v1_5} 5 | \title{Correlation value plot} 6 | \usage{ 7 | ggally_cor_v1_5( 8 | data, 9 | mapping, 10 | alignPercent = 0.6, 11 | method = "pearson", 12 | use = "complete.obs", 13 | corAlignPercent = NULL, 14 | corMethod = NULL, 15 | corUse = NULL, 16 | displayGrid = TRUE, 17 | ... 18 | ) 19 | } 20 | \arguments{ 21 | \item{data}{data set using} 22 | 23 | \item{mapping}{aesthetics being used} 24 | 25 | \item{alignPercent}{right align position of numbers. Default is 60 percent across the horizontal} 26 | 27 | \item{method}{\code{method} supplied to cor function} 28 | 29 | \item{use}{\code{use} supplied to cor function} 30 | 31 | \item{corAlignPercent}{deprecated. Use parameter \code{alignPercent}} 32 | 33 | \item{corMethod}{deprecated. Use parameter \code{method}} 34 | 35 | \item{corUse}{deprecated. Use parameter \code{use}} 36 | 37 | \item{displayGrid}{if TRUE, display aligned panel gridlines} 38 | 39 | \item{...}{other arguments being supplied to geom_text} 40 | } 41 | \description{ 42 | \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} 43 | 44 | Estimate correlation from the given data. 45 | 46 | This function is deprecated and will be removed in future releases. 47 | 48 | See \code{\link{ggally_cor}}. 49 | } 50 | \examples{ 51 | # Small function to display plots only if it's interactive 52 | p_ <- GGally::print_if_interactive 53 | 54 | data(tips) 55 | p_(ggally_cor_v1_5(tips, mapping = ggplot2::aes(total_bill, tip))) 56 | 57 | # display with no grid 58 | p_(ggally_cor_v1_5( 59 | tips, 60 | mapping = ggplot2::aes(total_bill, tip), 61 | displayGrid = FALSE 62 | )) 63 | 64 | # change text attributes 65 | p_(ggally_cor_v1_5( 66 | tips, 67 | mapping = ggplot2::aes(x = total_bill, y = tip), 68 | size = 15, 69 | colour = I("red") 70 | )) 71 | 72 | # split by a variable 73 | p_(ggally_cor_v1_5( 74 | tips, 75 | mapping = ggplot2::aes(total_bill, tip, color = sex), 76 | size = 5 77 | )) 78 | } 79 | \seealso{ 80 | \code{\link{ggally_cor}} 81 | } 82 | \author{ 83 | Barret Schloerke 84 | } 85 | \keyword{internal} 86 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/gglegend/plotnew-default.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Species 23 | 24 | 25 | 26 | 27 | 28 | 29 | setosa 30 | versicolor 31 | virginica 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/ggmatrix.md: -------------------------------------------------------------------------------- 1 | # stops 2 | 3 | Code 4 | ggmatrix(plots = matrix(), nrow = 2, ncol = 3) 5 | Condition 6 | Error in `ggmatrix()`: 7 | ! `plots` must be a `list()` 8 | 9 | --- 10 | 11 | Code 12 | ggmatrix(plots = list(), nrow = "2", ncol = 3) 13 | Condition 14 | Error in `check_nrow_ncol()`: 15 | ! `nrow` must be a numeric value 16 | 17 | --- 18 | 19 | Code 20 | ggmatrix(plots = list(), nrow = 2, ncol = "3") 21 | Condition 22 | Error in `check_nrow_ncol()`: 23 | ! `ncol` must be a numeric value 24 | 25 | --- 26 | 27 | Code 28 | ggmatrix(plots = list(), nrow = c(2, 3), ncol = 3) 29 | Condition 30 | Error in `check_nrow_ncol()`: 31 | ! `nrow` must be a single numeric value 32 | 33 | --- 34 | 35 | Code 36 | ggmatrix(plots = list(), nrow = 2, ncol = c(2, 3)) 37 | Condition 38 | Error in `check_nrow_ncol()`: 39 | ! `ncol` must be a single numeric value 40 | 41 | # expression labels 42 | 43 | Code 44 | print(ggpairs(tips, 1:2, columnLabels = expression(alpha, beta))) 45 | Condition 46 | Error in `get_labels()`: 47 | ! `xAxisLabels` can only be a character vector or `NULL`. 48 | i Character values can be parsed using the `labeller` parameter. 49 | 50 | # blank 51 | 52 | Code 53 | pm[2, 2] <- "not blank" 54 | Condition 55 | Error in `putPlot()`: 56 | ! character values (besides `'blank'`) are not allowed to be stored as plot values. 57 | 58 | # ggmatrix proportions 59 | 60 | Code 61 | ggmatrix_proportions("not auto", tips, 1:ncol(tips)) 62 | Condition 63 | Error in `ggmatrix_proportions()`: 64 | ! `proportions` need to be non-NA numeric values or `'auto'`. proportions: "not auto" 65 | 66 | --- 67 | 68 | Code 69 | ggmatrix_proportions(NA, tips, 1:ncol(tips)) 70 | Condition 71 | Error in `ggmatrix_proportions()`: 72 | ! `proportions` need to be non-NA numeric values or `'auto'`. proportions: NA 73 | 74 | --- 75 | 76 | Code 77 | ggmatrix_proportions(c(1, NA, 1, 1, 1, 1, 1), tips, 1:ncol(tips)) 78 | Condition 79 | Error in `ggmatrix_proportions()`: 80 | ! `proportions` need to be non-NA numeric values or `'auto'`. proportions: c(1, NA, 1, 1, 1, 1, 1) 81 | 82 | -------------------------------------------------------------------------------- /man/ggally_statistic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gg-plots.R 3 | \name{ggally_statistic} 4 | \alias{ggally_statistic} 5 | \title{Generalized text display} 6 | \usage{ 7 | ggally_statistic( 8 | data, 9 | mapping, 10 | text_fn, 11 | title, 12 | na.rm = NA, 13 | display_grid = FALSE, 14 | justify_labels = "right", 15 | justify_text = "left", 16 | sep = ": ", 17 | family = "mono", 18 | title_args = list(), 19 | group_args = list(), 20 | align_percent = 0.5, 21 | title_hjust = 0.5, 22 | group_hjust = 0.5 23 | ) 24 | } 25 | \arguments{ 26 | \item{data}{data set using} 27 | 28 | \item{mapping}{aesthetics being used} 29 | 30 | \item{text_fn}{function that takes in \code{x} and \code{y} and returns a text string} 31 | 32 | \item{title}{title text to be displayed} 33 | 34 | \item{na.rm}{logical value which determines if \code{NA} values are removed. If \code{TRUE}, no warning message will be displayed.} 35 | 36 | \item{display_grid}{if \code{TRUE}, display aligned panel grid lines. If \code{FALSE} (default), display a thin panel border.} 37 | 38 | \item{justify_labels}{\code{justify} argument supplied when \code{\link[base]{format}}ting the labels} 39 | 40 | \item{justify_text}{\code{justify} argument supplied when \code{\link[base]{format}}ting the returned \code{text_fn(x, y)} values} 41 | 42 | \item{sep}{separation value to be placed between the labels and text} 43 | 44 | \item{family}{font family used when displaying all text. This value will be set in \code{title_args} or \code{group_args} if no \code{family} value exists. By using \code{"mono"}, groups will align with each other.} 45 | 46 | \item{title_args}{arguments being supplied to the title's \code{\link[ggplot2]{geom_text}()}} 47 | 48 | \item{group_args}{arguments being supplied to the split-by-color group's \code{\link[ggplot2]{geom_text}()}} 49 | 50 | \item{align_percent}{relative align position of the text. When \code{title_hjust = 0.5} and \code{group_hjust = 0.5}, this should not be needed to be set.} 51 | 52 | \item{title_hjust, group_hjust}{\code{hjust} sent to \code{\link[ggplot2]{geom_text}()} for the title and group values respectively. Any \code{hjust} value supplied in \code{title_args} or \code{group_args} will take precedence.} 53 | } 54 | \description{ 55 | Generalized text display 56 | } 57 | \seealso{ 58 | \code{\link{ggally_cor}} 59 | } 60 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | 2 | ## Comments 3 | 4 | #### 2025-08-18 5 | 6 | The request has been fixed along with a couple other minor updates. 7 | 8 | Please let me know if I can provide any other information. 9 | 10 | Best, 11 | Barret 12 | 13 | 14 | #### 2025-07-22 15 | 16 | Dear maintainer, 17 | 18 | Please see the problems shown on 19 | . 20 | 21 | Please correct before 2025-08-25 to safely retain your package on CRAN. 22 | 23 | Do remember to look at any 'Additional issues'. 24 | 25 | It seems we need to remind you of the CRAN policy: 26 | 27 | 'Packages which use Internet resources should fail gracefully with an informative message 28 | if the resource is not available or has changed (and not give a check warning nor error).' 29 | 30 | This needs correction whether or not the resource recovers. 31 | 32 | The CRAN Team 33 | 34 | 35 | For the record, the failure (on M1mac) is 36 | 37 | > ### Name: ggcorr 38 | > ### Title: Correlation matrix 39 | > ### Aliases: ggcorr 40 | > 41 | > ### ** Examples 42 | > 43 | > # Small function to display plots only if it's interactive 44 | > p_ <- GGally::print_if_interactive 45 | > 46 | > # Basketball statistics provided by Nathan Yau at Flowing Data. 47 | > dt <- read.csv("http://datasets.flowingdata.com/ppg2008.csv") 48 | 49 | Warning in file(file, "rt") : 50 | URL 'http://datasets.flowingdata.com/ppg2008.csv': status was 51 | 'Couldn't resolve host name' 52 | Error in file(file, "rt") : 53 | cannot open the connection to 54 | 'http://datasets.flowingdata.com/ppg2008.csv' 55 | Calls: read.csv -> read.table -> file 56 | Execution halted 57 | 58 | 59 | 60 | ## R CMD check results 61 | 62 | * 0 errors | 0 warnings | 1 note 63 | 64 | ``` 65 | * checking CRAN incoming feasibility ... [16s] NOTE 66 | Maintainer: 'Barret Schloerke ' 67 | 68 | Found the following (possibly) invalid URLs: 69 | URL: https://www.oecd.org/en/data/datasets/pisa-2012-cba-database.html 70 | From: man/australia_PISA2012.Rd 71 | Status: 403 72 | Message: Forbidden 73 | ``` 74 | 75 | When visiting the link manually, the link works as expected. I believe they have a bot blocker that is causing this error. 76 | 77 | ## revdepcheck results 78 | 79 | We checked 141 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. 80 | 81 | * We saw 0 new problems 82 | -------------------------------------------------------------------------------- /man/ggbivariate.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggbivariate.R 3 | \name{ggbivariate} 4 | \alias{ggbivariate} 5 | \title{Display an outcome using several potential explanatory variables} 6 | \usage{ 7 | ggbivariate( 8 | data, 9 | outcome, 10 | explanatory = NULL, 11 | mapping = NULL, 12 | types = NULL, 13 | ..., 14 | rowbar_args = NULL 15 | ) 16 | } 17 | \arguments{ 18 | \item{data}{dataset to be used, can have both categorical and 19 | numerical variables} 20 | 21 | \item{outcome}{name or position of the outcome variable (one variable only)} 22 | 23 | \item{explanatory}{names or positions of the explanatory variables (if \code{NULL}, 24 | will take all variables other than \code{outcome})} 25 | 26 | \item{mapping}{additional aesthetic to be used, for example to indicate 27 | weights (see examples)} 28 | 29 | \item{types}{custom types of plots to use, see \code{\link{ggduo}}} 30 | 31 | \item{...}{additional arguments passed to \code{\link{ggduo}} (see examples)} 32 | 33 | \item{rowbar_args}{additional arguments passed to \code{\link{ggally_rowbar}} 34 | (see examples)} 35 | } 36 | \description{ 37 | \code{ggbivariate} is a variant of \code{\link{ggduo}} for plotting 38 | an outcome variable with several potential explanatory variables. 39 | } 40 | \examples{ 41 | # Small function to display plots only if it's interactive 42 | p_ <- GGally::print_if_interactive 43 | 44 | data(tips) 45 | p_(ggbivariate(tips, "smoker", c("day", "time", "sex", "tip"))) 46 | 47 | # Personalize plot title and legend title 48 | p_(ggbivariate( 49 | tips, "smoker", c("day", "time", "sex", "tip"), 50 | title = "Custom title" 51 | ) + 52 | labs(fill = "Smoker ?")) 53 | 54 | # Customize fill colour scale 55 | p_(ggbivariate(tips, "smoker", c("day", "time", "sex", "tip")) + 56 | scale_fill_brewer(type = "qual")) 57 | 58 | # Customize labels 59 | p_(ggbivariate( 60 | tips, "smoker", c("day", "time", "sex", "tip"), 61 | rowbar_args = list( 62 | colour = "white", 63 | size = 4, 64 | fontface = "bold", 65 | label_format = scales::label_percent(accurary = 1) 66 | ) 67 | )) 68 | 69 | # Choose the sub-plot from which get legend 70 | p_(ggbivariate(tips, "smoker")) 71 | p_(ggbivariate(tips, "smoker", legend = 3)) 72 | 73 | # Use mapping to indicate weights 74 | d <- as.data.frame(Titanic) 75 | p_(ggbivariate(d, "Survived", mapping = aes(weight = Freq))) 76 | 77 | # outcome can be numerical 78 | p_(ggbivariate(tips, outcome = "tip", title = "tip")) 79 | } 80 | \author{ 81 | Joseph Larmarange 82 | } 83 | -------------------------------------------------------------------------------- /man/ggally_cross.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggally_cross.R 3 | \name{ggally_cross} 4 | \alias{ggally_cross} 5 | \title{Plots the number of observations} 6 | \usage{ 7 | ggally_cross(data, mapping, ..., scale_max_size = 20, geom_text_args = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{data set using} 11 | 12 | \item{mapping}{aesthetics being used} 13 | 14 | \item{...}{other arguments passed to \code{\link[ggplot2:geom_point]{ggplot2::geom_point()}}} 15 | 16 | \item{scale_max_size}{\code{max_size} argument supplied to \code{\link[ggplot2:scale_size]{ggplot2::scale_size_area()}}} 17 | 18 | \item{geom_text_args}{other arguments passed to \code{\link[ggplot2:geom_text]{ggplot2::geom_text()}}} 19 | } 20 | \description{ 21 | Plot the number of observations by using square points 22 | with proportional areas. Could be filled according to chi-squared 23 | statistics computed by \code{\link[=stat_cross]{stat_cross()}}. Labels could also 24 | be added (see examples). 25 | } 26 | \examples{ 27 | # Small function to display plots only if it's interactive 28 | p_ <- GGally::print_if_interactive 29 | 30 | data(tips) 31 | p_(ggally_cross(tips, mapping = aes(x = smoker, y = sex))) 32 | p_(ggally_cross(tips, mapping = aes(x = day, y = time))) 33 | 34 | # Custom max size 35 | p_(ggally_cross(tips, mapping = aes(x = smoker, y = sex)) + 36 | scale_size_area(max_size = 40)) 37 | 38 | # Custom fill 39 | p_(ggally_cross(tips, mapping = aes(x = smoker, y = sex), fill = "red")) 40 | 41 | # Custom shape 42 | p_(ggally_cross(tips, mapping = aes(x = smoker, y = sex), shape = 21)) 43 | 44 | # Fill squares according to standardized residuals 45 | d <- as.data.frame(Titanic) 46 | p_(ggally_cross( 47 | d, 48 | mapping = aes(x = Class, y = Survived, weight = Freq, fill = after_stat(std.resid)) 49 | ) + 50 | scale_fill_steps2(breaks = c(-3, -2, 2, 3), show.limits = TRUE)) 51 | 52 | # Add labels 53 | p_(ggally_cross( 54 | tips, 55 | mapping = aes( 56 | x = smoker, y = sex, colour = smoker, 57 | label = scales::percent(after_stat(prop)) 58 | ) 59 | )) 60 | 61 | # Customize labels' appearance and same size for all squares 62 | p_(ggally_cross( 63 | tips, 64 | mapping = aes( 65 | x = smoker, y = sex, 66 | size = NULL, # do not map size to a variable 67 | label = scales::percent(after_stat(prop)) 68 | ), 69 | size = 40, # fix value for points size 70 | fill = "darkblue", 71 | geom_text_args = list(colour = "white", fontface = "bold", size = 6) 72 | )) 73 | } 74 | \author{ 75 | Joseph Larmarange 76 | } 77 | \keyword{hplot} 78 | -------------------------------------------------------------------------------- /man/ggfacet.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggfacet.R 3 | \name{ggfacet} 4 | \alias{ggfacet} 5 | \title{Single \pkg{ggplot2} plot matrix with \code{\link[ggplot2]{facet_grid}}} 6 | \usage{ 7 | ggfacet( 8 | data, 9 | mapping = NULL, 10 | columnsX = 1:ncol(data), 11 | columnsY = 1:ncol(data), 12 | fn = ggally_points, 13 | ..., 14 | columnLabelsX = names(data[columnsX]), 15 | columnLabelsY = names(data[columnsY]), 16 | xlab = NULL, 17 | ylab = NULL, 18 | title = NULL, 19 | scales = "free" 20 | ) 21 | } 22 | \arguments{ 23 | \item{data}{data.frame that contains all columns to be displayed. This data will be melted before being passed into the function \code{fn}} 24 | 25 | \item{mapping}{aesthetic mapping (besides \code{x} and \code{y}). See \code{\link[ggplot2]{aes}()}} 26 | 27 | \item{columnsX}{columns to be displayed in the plot matrix} 28 | 29 | \item{columnsY}{rows to be displayed in the plot matrix} 30 | 31 | \item{fn}{function to be executed. Similar to \code{\link{ggpairs}} and \code{\link{ggduo}}, the function may either be a string identifier or a real function that \code{\link{wrap}} understands.} 32 | 33 | \item{...}{extra arguments passed directly to \code{fn}} 34 | 35 | \item{columnLabelsX, columnLabelsY}{column and row labels to display in the plot matrix} 36 | 37 | \item{xlab, ylab, title}{plot matrix labels} 38 | 39 | \item{scales}{parameter supplied to \code{ggplot2::\link[ggplot2]{facet_grid}}. Default behavior is \code{"free"}} 40 | } 41 | \description{ 42 | Single \pkg{ggplot2} plot matrix with \code{\link[ggplot2]{facet_grid}} 43 | } 44 | \examples{ 45 | # Small function to display plots only if it's interactive 46 | p_ <- GGally::print_if_interactive 47 | if (requireNamespace("chemometrics", quietly = TRUE)) { 48 | data(NIR, package = "chemometrics") 49 | NIR_sub <- data.frame(NIR$yGlcEtOH, NIR$xNIR[, 1:3]) 50 | str(NIR_sub) 51 | x_cols <- c("X1115.0", "X1120.0", "X1125.0") 52 | y_cols <- c("Glucose", "Ethanol") 53 | 54 | # using ggduo directly 55 | p <- ggduo(NIR_sub, x_cols, y_cols, types = list(continuous = "points")) 56 | p_(p) 57 | 58 | # using ggfacet 59 | p <- ggfacet(NIR_sub, x_cols, y_cols) 60 | p_(p) 61 | 62 | # add a smoother 63 | p <- ggfacet(NIR_sub, x_cols, y_cols, fn = "smooth_loess") 64 | p_(p) 65 | # same output 66 | p <- ggfacet(NIR_sub, x_cols, y_cols, fn = ggally_smooth_loess) 67 | p_(p) 68 | 69 | # Change scales to be the same in for every row and for every column 70 | p <- ggfacet(NIR_sub, x_cols, y_cols, scales = "fixed") 71 | p_(p) 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /scripts/revdepcheck.R: -------------------------------------------------------------------------------- 1 | ## revdepcheck::revdep_reset(".") 2 | 3 | local({ 4 | dev_revdep <- function( 5 | pkg = ".", 6 | ..., 7 | num_workers = 6, 8 | timeout_mins = 30, 9 | all = TRUE, 10 | width = as.numeric(system("tput cols", intern = TRUE)) - 5, 11 | install_deps = TRUE 12 | ) { 13 | if (system.file(package = "remotes") == "") { 14 | install.packages("remotes") 15 | } 16 | if (system.file(package = "withr") == "") { 17 | install.packages("withr") 18 | } 19 | if (system.file(package = "pkgload") == "") { 20 | install.packages("pkgload") 21 | } 22 | if (system.file(package = "revdepcheck") == "") { 23 | remotes::install_github("r-lib/revdepcheck") 24 | } 25 | if (isTRUE(install_deps)) { 26 | if (system.file(package = "remotes") == "") { 27 | remotes::install_cran("desc") 28 | } 29 | 30 | # make sure all direct deps are from CRAN (not remotes) and the latest version 31 | remotes::install_cran( 32 | setdiff( 33 | desc::desc_get_deps(basename(normalizePath(pkg)))$package, 34 | c( 35 | "R", 36 | unname(installed.packages(priority = "base")[, 37 | "Package", 38 | drop = TRUE 39 | ]) 40 | ) 41 | ) 42 | ) 43 | } 44 | 45 | pkg_path <- pkgload::pkg_path(pkg) 46 | 47 | # run in non-interactive process to avoid personalized setup 48 | callr::r( 49 | function(pkg_path_, num_workers_, timeout_mins_, ..., width_, all_) { 50 | withr::with_options(list(width = width_), { 51 | revdepcheck::revdep_check( 52 | pkg = pkg_path_, 53 | ..., 54 | num_workers = num_workers_, 55 | timeout = as.difftime(timeout_mins_, units = "mins") 56 | ) 57 | capture.output({ 58 | revdepcheck::revdep_report_cran(pkg_path_) 59 | }) |> 60 | paste0(collapse = "\n") |> 61 | cat(file = file.path(pkg_path_, "revdep/revdep_cran.md")) 62 | if (isTRUE(all_)) { 63 | message("Saving all report information (this may take a minute)") 64 | revdepcheck::revdep_report(pkg_path_, all = all_) 65 | } 66 | }) 67 | }, 68 | list( 69 | pkg_path_ = pkg_path, 70 | num_workers_ = num_workers, 71 | timeout_mins_ = timeout_mins, 72 | ..., 73 | width_ = width, 74 | all_ = all 75 | ), 76 | show = TRUE 77 | ) 78 | } 79 | 80 | # revdepcheck 81 | dev_revdep() 82 | }) 83 | -------------------------------------------------------------------------------- /vignettes/ggsurv.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ggsurv(): Survival curves" 3 | output: rmarkdown::html_vignette 4 | author: Edwin Thoen 5 | date: April, 4, 2016 6 | vignette: > 7 | %\VignetteIndexEntry{ggsurv(): Survival curves} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | ```{r, include = FALSE} 13 | knitr::opts_chunk$set( 14 | collapse = TRUE, 15 | comment = "#>" 16 | ) 17 | ``` 18 | 19 | ```{r setup} 20 | library(GGally) 21 | ``` 22 | 23 | # `GGally::ggsurv()` 24 | 25 | 26 | 27 | This function produces Kaplan-Meier plots using `ggplot2`. 28 | As a first argument, `ggsurv()` needs a `survival::survfit()` object. 29 | Default settings differ for single stratum and multiple strata objects. 30 | 31 | ## Single Stratum 32 | ```{r basic-usage, fig.height=7, fig.width=7} 33 | require(ggplot2) 34 | require(survival) 35 | require(scales) 36 | 37 | data(lung, package = "survival") 38 | sf.lung <- survival::survfit(Surv(time, status) ~ 1, data = lung) 39 | ggsurv(sf.lung) 40 | ``` 41 | 42 | ## Multiple Stratum 43 | 44 | The legend color positions matches the survival order or each stratum, where the stratums that end at a lower value or time have a position that is lower in the legend. 45 | 46 | ```{r ggsurv-multiple} 47 | sf.sex <- survival::survfit(Surv(time, status) ~ sex, data = lung) 48 | pl.sex <- ggsurv(sf.sex) 49 | pl.sex 50 | ``` 51 | 52 | ## Alterations 53 | 54 | Since a ggplot2 object is returned, plot objects may be altered after the original creation. 55 | 56 | ### Adjusting the legend 57 | 58 | ```{r ggsurv-legend} 59 | pl.sex + 60 | ggplot2::guides(linetype = "none") + 61 | ggplot2::scale_colour_discrete( 62 | name = "Sex", 63 | breaks = c(1, 2), 64 | labels = c("Male", "Female") 65 | ) 66 | ``` 67 | 68 | ### Adjust the limits 69 | 70 | ```{r ggsurv-limits} 71 | data(kidney, package = "survival") 72 | sf.kid <- survival::survfit(Surv(time, status) ~ disease, data = kidney) 73 | pl.kid <- ggsurv(sf.kid, plot.cens = FALSE) 74 | pl.kid 75 | 76 | # Zoom in to first 80 days 77 | pl.kid + ggplot2::coord_cartesian(xlim = c(0, 80), ylim = c(0.45, 1)) 78 | ``` 79 | 80 | ### Add text and remove the legend 81 | ```{r ggsurv-text} 82 | pl.kid + 83 | ggplot2::annotate( 84 | "text", 85 | label = c("PKD", "Other", "GN", "AN"), 86 | x = c(90, 125, 5, 60), 87 | y = c(0.8, 0.65, 0.55, 0.30), 88 | size = 5, 89 | colour = scales::pal_hue( 90 | h = c(0, 360) + 15, 91 | c = 100, 92 | l = 65, 93 | h.start = 0, 94 | direction = 1 95 | )(4) 96 | ) + 97 | ggplot2::guides(color = "none", linetype = "none") 98 | ``` 99 | --------------------------------------------------------------------------------