colorbar: Vertical color bar

Description Usage Arguments Value Author(s) Examples

View source: R/colorbar.R

Description

Adds a vertical color bar to a plot with a custom axis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
colorbar(
  xleft,
  ybottom,
  xright,
  ytop,
  col = gray.colors(256, 0, 1),
  n = length(col),
  clim = c(0, 1),
  show.border = TRUE,
  text = "",
  line = 2,
  show.axis = TRUE,
  side = "right",
  lwd = 1,
  nticks = 5,
  at = NULL,
  ...
)

Arguments

xleft

left x-coordinate of the bar

ybottom

bottom y-coordinate of the bar

xright

right x-coordinate of the bar

ytop

top y-coordinate of the bar

col

vector of colors

n

number of polygons used to draw the bar

clim

2-vector specifying the range of values, linearly represented by the full color scale

show.border

logical flag specifying whether to draw a rectangular border around the bar

text

axis label

line

distance between label and color bar

show.axis

logical flag specifying whether to draw an axis

side

character string, which specifies the location of the axis on the bar. This has to be 'left' or 'right' (default).

lwd

linewidth of border and ticks

nticks

number of ticks on the axis

at

vector of values specifying the tick positions on the axis, this overrides nticks.

...

optional arguments to be passed to the function axis

Value

None

Author(s)

Danail Obreschkow

Examples

1
2
3
4
5
6
## Plot a spherical function with color bar
nplot(xlim=c(0,1.2), asp=1)
f = function(theta,phi) cos(10*theta+phi)
sp = sphereplot(f, 200, col=planckcolors(200), phi0=0.1, theta0=pi/3,
add=TRUE, center=c(0.5,0.5), radius=0.4, clim=c(-1,1))
colorbar(1,0.1,1.1,0.9,col=sp$col,clim=sp$clim)

graphx documentation built on Feb. 3, 2022, 5:07 p.m.

Related to colorbar in graphx...