drawOpenKey(key, draw = FALSE, vp = NULL)
draw.colorkey
function.
Original draw.colorkey
options:
space
location of the scale key ("left", "right",
drawOpenKey
is a crude modification of
lattice::draw.colorkey
, that provides labelling
options for lattice::draw.colorkey
and returns a scale key
using a similar mechanism to that used in in the original
function as developed by Deepayan Sarkar.drawOpenKey
function produces scale keys for
other openair functions.
Most drawOpenKey
options are identical to those of
lattice::draw.colorkey
. For example, scale key
size and position are controlled via height
,
width
and space
. Likewise, the axis
labelling can be set in and formatted by labels
.
See draw.colorkey
for further details.
Additional scale labelling may be added above and below
the scale using header
and footer
options
within key
. As in other openair
functions,
automatic text formatting can be enabled via
auto.key
.
(Note: Currently, the formatting of header
and
footer
text are fixed to the same style as
labels
(the scale axis) and cannot be defined
locally.)
The relationship between header
, footer
and
the scale key itself can be controlled using fit
options. These can be set in key$fit
to apply
uniform control or individually in key$header$fit
and/or key$footer$fit
to control locally.
The appearance of the scale can be controlled using
plot.style
.drawOpenKey
currently include
windRose
, pollutionRose
.
For details of the original function, see
draw.colorkey
##########
#example 1
##########
#paddle style scale key used by windRose
windRose(mydata,)
#adding text and changing style and position via key
#note:
#some simple key control also possible directly
#For example, below does same as
#windRose(mydata, key.position="right")
windRose(mydata,
key =list(space="right")
)
#however:
#more detailed control possible working with
#key and drawOpenKey. For example,
windRose(mydata,
key = list(header="Title", footer="wind speed",
plot.style = c("ticks", "border"),
fit = "all", height = 1,
space = "top")
)
Run the code above in your browser using DataLab