MyNixOS website logo
Description

Themes for Base Graphics Plots.

Functions to create and select graphical themes for the base plotting system. Contains: 1) several custom pre-made themes 2) mechanism for creating new themes by making persistent changes to the graphical parameters of base plots.

CRAN version dependencies Monthly Downloads

basetheme

R package implementing a theming system for base plotting.

Description

The basetheme() function provides a persistent way to set and unset R plotting settings. All the user has to do is set the theme once and it will be consistently applied to all the subsequent plots even after the graphics device is closed. The function only works with base graphics system, so if you are exclusively working with ggplot2, boy, did you install the wrong package.

Usage

The persistent settings are controlled via the basetheme() function. To an extent this function mimics the behaviour and arguments of par() and has multiple modes of operation:

# Specifying the `par()` values directly:
basetheme(pch=19, mgp=c(2,.7,0), tck=-.01)

# Choosing a theme by name:
basetheme("clean")

# Using a mix of the above:
basetheme("minimal", bg="grey", pch=1)

# Specifying a list with theme values:
theme <- basetheme("clean")
theme$cex.main <- 2
basetheme(theme)

# Obtaining a list of parameters for the current theme:
basetheme()

# Removing the current theme:
basetheme(NULL)

In addition to basetheme() two additional functions are provided for colors manipulation within the plots: num2col() and lab2col(). See documentation: help(basetheme), help(num2col), help(lab2col) and examples: example(basetheme), example(num2col), example(lab2col) for more details.

Some Examples

A few examples using of how it all works together.

basetheme("void")
boxplot(split(iris$Sepal.Width, iris$Species))

basetheme("clean")
barplot(rivers, col=num2col(rivers))

basetheme("brutal")
plot(hclust(dist(USArrests), "ward.D2"), hang=-1)

basetheme("royal")
pairs(iris[-5], bg=lab2col(iris$Species), col=0)

basetheme("deepblue")
pairs(iris[-5], bg=num2col(iris[,1]), col=0)

x <- seq(-1.95, 1.95, length = 30)
y <- seq(-1.95, 1.95, length = 35)
z <- outer(x, y, function(a, b) a*b^2)

basetheme("dark")
persp(x, y, z, theta=-45)

More Details

Additional details can be found in the Wiki pages:

  1. List of Available Themes
  2. Creating Custom Themes
  3. Installation Instructions
  4. Implementation Details

See Also

CRAN:

  1. prettyB

GitHub:

  1. styles.
Metadata

Version

0.1.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD 13
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd13
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd13
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows