showColors | R Documentation |
Show colors from a vector or list
showColors(
x,
labelCells = NULL,
transpose = FALSE,
srtCellnote = NULL,
adjustMargins = TRUE,
makeUnique = FALSE,
doPlot = TRUE,
...
)
x |
one of these input types:
|
labelCells |
|
transpose |
|
srtCellnote |
|
adjustMargins |
|
makeUnique |
|
doPlot |
|
... |
additional parameters are passed to |
This function simply displays colors for review, using
imageByColors()
to display colors and labels across the
plot space.
When supplied a list
, each row in imageByColors()
represents
an entry in the list
. Nothing fancy.
invisible color matrix
used by imageByColors()
. When
the input x
is empty, or cannot be converted to colors when
x
contains a function
, the output returns NULL
.
Other jam plot functions:
adjustAxisLabelMargins()
,
coordPresets()
,
decideMfrow()
,
drawLabels()
,
getPlotAspect()
,
groupedAxis()
,
imageByColors()
,
imageDefault()
,
minorLogTicksAxis()
,
nullPlot()
,
plotPolygonDensity()
,
plotRidges()
,
plotSmoothScatter()
,
shadowText_options()
,
shadowText()
,
smoothScatterJam()
,
sqrtAxis()
,
usrBox()
Other jam color functions:
alpha2col()
,
applyCLrange()
,
col2alpha()
,
col2hcl()
,
col2hsl()
,
col2hsv()
,
color2gradient()
,
fixYellowHue()
,
fixYellow()
,
getColorRamp()
,
hcl2col()
,
hsl2col()
,
hsv2col()
,
isColor()
,
kable_coloring()
,
makeColorDarker()
,
make_html_styles()
,
make_styles()
,
rgb2col()
,
setCLranges()
,
setTextContrastColor()
,
unalpha()
,
warpRamp()
x <- color2gradient(list(Reds=c("red"), Blues=c("blue")), n=c(4,7));
showColors(x);
showColors(getColorRamp("firebrick3"))
if (suppressPackageStartupMessages(require(RColorBrewer))) {
RColorBrewer_namelist <- rownames(RColorBrewer::brewer.pal.info);
y <- lapply(nameVector(RColorBrewer_namelist), function(i){
n <- RColorBrewer::brewer.pal.info[i, "maxcolors"]
j <- RColorBrewer::brewer.pal(n, i);
nameVector(j, seq_along(j));
});
showColors(y, cexCellnote=0.6, cex.axis=0.7, main="Brewer Colors");
}
if (suppressPackageStartupMessages(require(viridis))) {
# given one function name it will display discrete colors
showColors(viridis)
# a list of functions will show each function output
showColors(list(viridis=viridis,
inferno=inferno))
# grab the full viridis color map
z <- rgb2col(viridis.map[,c("R","G","B")]);
# split the colors into a list
viridis_names <- c(A="magma",
B="inferno",
C="plasma",
D="viridis",
E="cividis",
F="rocket",
G="mako",
H="turbo")
y <- split(z,
paste0(viridis.map$opt, ": ",
viridis_names[viridis.map$opt]));
showColors(y, labelCells=TRUE, xaxt="n", main="viridis.map colors");
}
# demonstrate makeUnique=TRUE
j1 <- getColorRamp("rainbow", n=7);
names(j1) <- seq_along(j1);
j2 <- rep(j1, each=3);
names(j2) <- makeNames(names(j2), suffix="_rep");
j2
showColors(list(
j1=j1,
j2=j2,
j3=j2),
makeUnique=c(FALSE, FALSE, TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.