Skip to content

Don't install interp #4806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ jobs:
mapproj=?ignore-before-r=3.5.0,
multcomp=?ignore-before-r=3.5.0,
quantreg=?ignore-before-r=3.5.0,
interp=?ignore-before-r=3.5.0
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Suggests:
ggplot2movies,
hexbin,
Hmisc,
interp,
knitr,
lattice,
mapproj,
Expand Down
35 changes: 9 additions & 26 deletions R/geom-contour.r
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#' 2D contours of a 3D surface
#'
#' @description
#' ggplot2 can not draw true 3D surfaces, but you can use `geom_contour()`,
#' `geom_contour_filled()`, and [geom_tile()] to visualise 3D surfaces in 2D. To
#' specify a valid surface, the data must contain `x`, `y`, and `z` coordinates,
#' and each unique combination of `x` and `y` can appear at most once.
#' Contouring requires that the points can be rearranged so that the `z` values
#' form a matrix, with rows corresponding to unique `x` values, and columns
#' corresponding to unique `y` values. Missing entries are allowed, but contouring
#' will only be done on cells of the grid with all four `z` values present. If
#' your data is irregular, you can interpolate to a grid before visualising
#' using the [interp::interp()] function from the `interp` package
#' (or one of the interpolating functions from the `akima` package.)
#' `geom_contour_filled()`, and [geom_tile()] to visualise 3D surfaces in 2D.
#'
#' These functions require regular data, where the `x` and `y` coordinates
#' form an equally spaced grid, and each combination of `x` and `y` appears
#' once. Missing values of `z` are allowed, but contouring will only work for
#' grid points where all four corners are non-missing. If you have irregular
#' data, you'll need to first interpolate on to a grid before visualising,
#' using [interp::interp()], [akima::bilinear()], or similar.
#'
#' @eval rd_aesthetics("geom", "contour")
#' @eval rd_aesthetics("geom", "contour_filled")
Expand Down Expand Up @@ -56,22 +55,6 @@
#' v + geom_contour(colour = "red")
#' v + geom_raster(aes(fill = density)) +
#' geom_contour(colour = "white")
#'
#' # Irregular data
#' if (requireNamespace("interp")) {
#' # Use a dataset from the interp package
#' data(franke, package = "interp")
#' origdata <- as.data.frame(interp::franke.data(1, 1, franke))
#' grid <- with(origdata, interp::interp(x, y, z))
#' griddf <- subset(data.frame(x = rep(grid$x, nrow(grid$z)),
#' y = rep(grid$y, each = ncol(grid$z)),
#' z = as.numeric(grid$z)),
#' !is.na(z))
#' ggplot(griddf, aes(x, y, z = z)) +
#' geom_contour_filled() +
#' geom_point(data = origdata)
#' } else
#' message("Irregular data requires the 'interp' package")
#' }
geom_contour <- function(mapping = NULL, data = NULL,
stat = "contour", position = "identity",
Expand Down
34 changes: 8 additions & 26 deletions man/geom_contour.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.