colorbar {cooltools} | R Documentation |
Vertical color bar
Description
Adds a vertical color bar to a plot with a custom axis.
Usage
colorbar(
xleft,
ybottom,
xright,
ytop,
col = gray.colors(256, 0, 1),
clim = c(0, 1),
show.border = TRUE,
text = "",
line = 2,
show.axis = TRUE,
side = "right",
lwd = 1,
nticks = 5,
at = NULL,
srt = 0,
ticklength = 0.1,
shift = 0,
...
)
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 |
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. |
srt |
rotation angle of tick text |
ticklength |
length of ticks |
shift |
extra distance between axis numbers and color bar |
... |
optional arguments to be passed text function. |
Value
None
Author(s)
Danail Obreschkow
Examples
## 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)