guess_has_R4.1_features: Guess whether "active" graphics device supports the grid...

View source: R/standalone-guess_has_R4.1_features.R

guess_has_R4.1_featuresR Documentation

Guess whether "active" graphics device supports the grid graphics features introduced in R v4.1.

Description

guess_has_R4.1_features() guesses whether "active" graphics device supports the grid graphics features introduced in R v4.1. If it guesses it does it returns TRUE else FALSE.

Usage

guess_has_R4.1_features(
  features = c("clippingPaths", "gradients", "masks", "patterns")
)

Arguments

features

Character vector of features to guess support for. Will return TRUE only if guesses support for all requested features.

"clippingPaths"

Supports clipping path feature

"gradients"

Supports (both linear and radial) gradient feature

"masks"

Supports (alpha) mask feature

"patterns"

Supports (tiling) pattern feature

Value

TRUE if we guess all features are supported else FALSE

Usage in other packages

To avoid taking a dependency on gridpattern you may copy the source of guess_has_R4.1_features() into your own package under the permissive MIT No Attribution (MIT-0) license. Either use usethis::use_standalone("trevorld/gridpattern", "standalone-guess_has_R4.1_features.R") or copy the file standalone-guess_has_R4.1_features.R into your R directory and add grDevices and utils to the Imports of your DESCRIPTION file.

See Also

https://www.stat.auckland.ac.nz/~paul/Reports/GraphicsEngine/definitions/definitions.html for more info about the new grid graphics features introduced in R v4.1.

Examples

  # If R version (weakly) greater than 4.1 should be TRUE
  pdf(tempfile(fileext = ".pdf"))
  print(guess_has_R4.1_features())
  invisible(dev.off())

  # Should be FALSE
  postscript(tempfile(fileext = ".ps"))
  print(guess_has_R4.1_features())
  invisible(dev.off())


gridpattern documentation built on Oct. 26, 2023, 1:07 a.m.