testCol | R Documentation |
Display colours as round patches in a plot. Useful for programming purposes.
Colours can be specified in any of 3 different ways:
(i) by colour name,
(ii) by hexadecimal colour code created by rgb()
, or
(iii) by calling one of the colour palettes.
testCol(cnam=colors()[sample(length(colors()),15)])
cnam |
|
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2023-10-18
In package PBSmodelling:
pickCol
,
testAlpha
In package PBStools:
testPch
In package grDevices:
palettes
local(envir=.PBSmodEnv,expr={
# mix and match patterns
testCol(c("sky","fire","sea","wood"))
})
local(envir=.PBSmodEnv,expr={
# display transparencies of blue
testCol(rgb(0,0,1,seq(0.05,1,0.05)))
})
local(envir=.PBSmodEnv,expr={
# display colours of the rainbow
testCol(rainbow(64,end=0.75))
})
local(envir=.PBSmodEnv,expr={
# display basic palette colours
testCol(1:length(palette()))
})
local(envir=.PBSmodEnv,expr={
# mix colour types
testCol(c("#9e7ad3", "purple", 6))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.