Skip to content

Instantly share code, notes, and snippets.

@avinab-neogy
Created February 26, 2025 18:42
Show Gist options
  • Select an option

  • Save avinab-neogy/2f26bf4155c4a73c592af7d429bc8f12 to your computer and use it in GitHub Desktop.

Select an option

Save avinab-neogy/2f26bf4155c4a73c592af7d429bc8f12 to your computer and use it in GitHub Desktop.
Patch fixes error messages and documentation in grid::dataViewport() to clarify numeric vector requirements
Index: src/library/grid/R/viewport.R
===================================================================
--- src/library/grid/R/viewport.R (revision 87829)
+++ src/library/grid/R/viewport.R (working copy)
@@ -454,12 +454,12 @@
extension <- rep(extension, length.out = 2)
if (is.null(xscale)) {
if (is.null(xData))
- stop("must specify at least one of 'x' or 'xscale'")
+ stop("must specify at least one of 'xData' or 'xscale'")
xscale <- extendrange(xData, f = extension[1L])
}
if (is.null(yscale)) {
if (is.null(yData))
- stop("must specify at least one of 'y' or 'yscale'")
+ stop("must specify at least one of 'yData' or 'yscale'")
yscale <- extendrange(yData, f = extension[2L])
}
viewport(xscale = xscale, yscale = yscale, ...)
Index: src/library/grid/man/dataViewport.Rd
===================================================================
--- src/library/grid/man/dataViewport.Rd (revision 87829)
+++ src/library/grid/man/dataViewport.Rd (working copy)
@@ -27,8 +27,8 @@
the \code{viewport()} function. }
}
\details{
- If \code{xscale} is not specified then the values in \code{x} are
- used to generate an x-scale based on the range of \code{x}, extended
+ If \code{xscale} is not specified then the values in \code{xData} are
+ used to generate an x-scale based on the range of \code{xData}, extended
by the proportion specified in \code{extension}. Similarly for the
y-scale.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment