equispaced_colorkey: fix non-equispaced colorkey

View source: R/draw.colorkey.R

equispaced_colorkeyR Documentation

fix non-equispaced colorkey

Description

Not processed if key$equispaced is not true.

Usage

equispaced_colorkey(key)

Arguments

key

A colorkey object (list), at least with the element of at.

Examples

library(magrittr)

x <- seq(pi/4, 5 * pi, length.out = 100)
y <- seq(pi/4, 5 * pi, length.out = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))
grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
at = c(0.1, 0.2, 0.5, 1, Inf) %>% c(-rev(.), 0, .)
levelplot(z ~ x * y, grid, cuts = 50, scales=list(log="e"), xlab="",
        ylab="", main="Weird Function", sub="with log scales",
        at = at,
        colorkey = TRUE, region = TRUE) +
    theme_lattice(plot.margin = c(1, 4, 1, 0))

kongdd/latticeGrob documentation built on March 30, 2024, 3:35 a.m.