This function displays color palettes using ggplot2.
Usage
show_palettes(
palettes = NULL,
type = c("discrete", "continuous"),
index = NULL,
palette_names = NULL,
return_names = TRUE,
return_palettes = FALSE
)Arguments
- palettes
A list of color palettes. Default is
NULL.- type
The type of palettes to include. Default is
"discrete".- index
The indices of the palettes to include. Default is
NULL.- palette_names
The names of the palettes to include. Default is
NULL.- return_names
Whether to return the names of the selected palettes. Default is
TRUE.- return_palettes
Whether to return the colors of selected palettes. Default is
FALSE.
Value
If return_palettes is TRUE, returns a list of color palettes. If return_names is TRUE (default), returns a character vector of palette names. Otherwise, returns NULL (called for side effects to display the plot).
Examples
show_palettes(
palettes = list(
c("red", "blue", "green"),
c("yellow", "purple", "orange")
)
)
#> [1] "1" "2"
all_palettes <- show_palettes(return_palettes = TRUE)
names(all_palettes)
#> [1] "BrBG" "PiYG" "PRGn"
#> [4] "PuOr" "RdBu" "RdGy"
#> [7] "RdYlBu" "RdYlGn" "Spectral"
#> [10] "Accent" "Dark2" "Paired"
#> [13] "Pastel1" "Pastel2" "Set1"
#> [16] "Set2" "Set3" "Blues"
#> [19] "BuGn" "BuPu" "GnBu"
#> [22] "Greens" "Greys" "Oranges"
#> [25] "OrRd" "PuBu" "PuBuGn"
#> [28] "PuRd" "Purples" "RdPu"
#> [31] "Reds" "YlGn" "YlGnBu"
#> [34] "YlOrBr" "YlOrRd" "npg"
#> [37] "aaas" "nejm" "lancet"
#> [40] "jama" "jco" "ucscgb"
#> [43] "d3-category10" "d3-category20" "d3-category20b"
#> [46] "d3-category20c" "igv" "locuszoom"
#> [49] "uchicago-default" "uchicago-light" "uchicago-dark"
#> [52] "cosmic" "simpsons" "futurama"
#> [55] "rickandmorty" "startrek" "tron"
#> [58] "frontiers" "flatui" "gsea"
#> [61] "material-red" "material-pink" "material-purple"
#> [64] "material-deep-purple" "material-indigo" "material-blue"
#> [67] "material-light-blue" "material-cyan" "material-teal"
#> [70] "material-green" "material-light-green" "material-lime"
#> [73] "material-yellow" "material-amber" "material-orange"
#> [76] "material-deep-orange" "material-brown" "material-grey"
#> [79] "material-blue-grey" "dPBIYlBu" "dPBIYlPu"
#> [82] "dPBIPuGn" "dPBIPuOr" "dPBIRdBu"
#> [85] "dPBIRdGy" "dPBIRdGn" "qMSOStd"
#> [88] "qMSO12" "qMSO15" "qMSOBuWarm"
#> [91] "qMSOBu" "qMSOBu2" "qMSOBuGn"
#> [94] "qMSOGn" "qMSOGnYl" "qMSOYl"
#> [97] "qMSOYlOr" "qMSOOr" "qMSOOrRd"
#> [100] "qMSORdOr" "qMSORd" "qMSORdPu"
#> [103] "qMSOPu" "qMSOPu2" "qMSOMed"
#> [106] "qMSOPap" "qMSOMrq" "qMSOSlp"
#> [109] "qMSOAsp" "qPBI" "sPBIGn"
#> [112] "sPBIGy1" "sPBIRd" "sPBIYl"
#> [115] "sPBIGy2" "sPBIBu" "sPBIOr"
#> [118] "sPBIPu" "sPBIYlGn" "sPBIRdPu"
#> [121] "ag_GrnYl" "ag_Sunset" "ArmyRose"
#> [124] "Earth" "Fall" "Geyser"
#> [127] "TealRose" "Temps" "Tropic"
#> [130] "Antique" "Bold" "Pastel"
#> [133] "Prism" "Safe" "Vivid"
#> [136] "BluGrn" "BluYl" "BrwnYl"
#> [139] "Burg" "BurgYl" "DarkMint"
#> [142] "Emrld" "Magenta" "Mint"
#> [145] "OrYel" "Peach" "PinkYl"
#> [148] "Purp" "PurpOr" "RedOr"
#> [151] "Sunset" "SunsetDark" "Teal"
#> [154] "TealGrn" "polarnight" "snowstorm"
#> [157] "frost" "aurora" "lumina"
#> [160] "mountain_forms" "silver_mine" "lake_superior"
#> [163] "victory_bonds" "halifax_harbor" "moose_pond"
#> [166] "algoma_forest" "rocky_mountain" "red_mountain"
#> [169] "baie_mouton" "afternoon_prarie" "magma"
#> [172] "inferno" "plasma" "viridis"
#> [175] "cividis" "rocket" "mako"
#> [178] "turbo" "ocean.algae" "ocean.deep"
#> [181] "ocean.dense" "ocean.gray" "ocean.haline"
#> [184] "ocean.ice" "ocean.matter" "ocean.oxy"
#> [187] "ocean.phase" "ocean.solar" "ocean.thermal"
#> [190] "ocean.turbid" "ocean.balance" "ocean.curl"
#> [193] "ocean.delta" "ocean.amp" "ocean.speed"
#> [196] "ocean.tempo" "BrowntoBlue.10" "BrowntoBlue.12"
#> [199] "BluetoDarkOrange.12" "BluetoDarkOrange.18" "DarkRedtoBlue.12"
#> [202] "DarkRedtoBlue.18" "BluetoGreen.14" "BluetoGray.8"
#> [205] "BluetoOrangeRed.14" "BluetoOrange.10" "BluetoOrange.12"
#> [208] "BluetoOrange.8" "LightBluetoDarkBlue.10" "LightBluetoDarkBlue.7"
#> [211] "Categorical.12" "GreentoMagenta.16" "SteppedSequential.5"
#> [214] "jcolors-default" "jcolors-pal2" "jcolors-pal3"
#> [217] "jcolors-pal4" "jcolors-pal5" "jcolors-pal6"
#> [220] "jcolors-pal7" "jcolors-pal8" "jcolors-pal9"
#> [223] "jcolors-pal10" "jcolors-pal11" "jcolors-pal12"
#> [226] "jcolors-rainbow" "jet" "simspec"
#> [229] "GdRd" "Chinese" "ChineseContinuous"
#> [232] "ChineseSet8" "ChineseSet16" "ChineseSet32"
#> [235] "ChineseSet64" "ChineseSet128" "ChineseBlue"
#> [238] "ChineseCyan" "ChineseGray_brown" "ChineseGreen"
#> [241] "ChineseOrange" "ChinesePurple" "ChineseRed"
#> [244] "ChineseYellow"
all_palettes[["simspec"]]
#> [1] "#c22b86" "#f769a1" "#fcc5c1" "#253777" "#1d92c0" "#9ec9e1" "#015b33"
#> [8] "#42aa5e" "#d9f0a2" "#E66F00" "#f18c28" "#FFBB61"
#> attr(,"type")
#> [1] "discrete"
show_palettes(index = 1:10)
#> [1] "BrBG" "PiYG" "PRGn" "PuOr" "RdBu" "RdGy"
#> [7] "RdYlBu" "RdYlGn" "Spectral" "Accent"
show_palettes(
type = "discrete",
index = 1:10
)
#> [1] "Accent" "Dark2" "Paired" "Pastel1" "Pastel2" "Set1" "Set2"
#> [8] "Set3" "npg" "aaas"
show_palettes(
type = "continuous",
index = 1:10
)
#> [1] "BrBG" "PiYG" "PRGn" "PuOr" "RdBu" "RdGy"
#> [7] "RdYlBu" "RdYlGn" "Spectral" "Blues"
show_palettes(
palette_names = c(
"Paired", "nejm", "simspec", "Spectral", "jet", "Chinese"
),
return_palettes = TRUE
)
#> $Paired
#> [1] "#A6CEE3" "#1F78B4" "#B2DF8A" "#33A02C" "#FDBF6F" "#FF7F00" "#FB9A99"
#> [8] "#E31A1C" "#CAB2D6" "#6A3D9A" "#FFFF99" "#B15928"
#> attr(,"type")
#> [1] "discrete"
#>
#> $nejm
#> TallPoppy DeepCerulean Zest Eucalyptus WildBlueYonder
#> "#BC3C29" "#0072B5" "#E18727" "#20854E" "#7876B1"
#> Gothic Salomie FrenchRose
#> "#6F99AD" "#FFDC91" "#EE4C97"
#> attr(,"type")
#> [1] "discrete"
#>
#> $simspec
#> [1] "#c22b86" "#f769a1" "#fcc5c1" "#253777" "#1d92c0" "#9ec9e1" "#015b33"
#> [8] "#42aa5e" "#d9f0a2" "#E66F00" "#f18c28" "#FFBB61"
#> attr(,"type")
#> [1] "discrete"
#>
#> $Spectral
#> [1] "#5E4FA2" "#3288BD" "#66C2A5" "#ABDDA4" "#E6F598" "#FFFFBF" "#FEE08B"
#> [8] "#FDAE61" "#F46D43" "#D53E4F" "#9E0142"
#> attr(,"type")
#> [1] "continuous"
#>
#> $jet
#> [1] "#00007A" "#000085" "#00008F" "#000099" "#0000A3" "#0000AD" "#0000B8"
#> [8] "#0000C2" "#0000CC" "#0000D6" "#0000E0" "#0000EB" "#0000F5" "#0000FF"
#> [15] "#000AFF" "#0014FF" "#001FFF" "#0029FF" "#0033FF" "#003DFF" "#0047FF"
#> [22] "#0052FF" "#005CFF" "#0066FF" "#0070FF" "#007AFF" "#0085FF" "#008FFF"
#> [29] "#0099FF" "#00A3FF" "#00ADFF" "#00B8FF" "#00C2FF" "#00CCFF" "#00D6FF"
#> [36] "#00E0FF" "#00EBFF" "#00F5FF" "#00FFFF" "#0AFFF5" "#14FFEB" "#1FFFE0"
#> [43] "#29FFD6" "#33FFCC" "#3DFFC2" "#47FFB8" "#52FFAD" "#5CFFA3" "#66FF99"
#> [50] "#70FF8F" "#7AFF85" "#85FF7A" "#8FFF70" "#99FF66" "#A3FF5C" "#ADFF52"
#> [57] "#B8FF47" "#C2FF3D" "#CCFF33" "#D6FF29" "#E0FF1F" "#EBFF14" "#F5FF0A"
#> [64] "#FFFF00" "#FFF500" "#FFEB00" "#FFE000" "#FFD600" "#FFCC00" "#FFC200"
#> [71] "#FFB800" "#FFAD00" "#FFA300" "#FF9900" "#FF8F00" "#FF8500" "#FF7A00"
#> [78] "#FF7000" "#FF6600" "#FF5C00" "#FF5200" "#FF4700" "#FF3D00" "#FF3300"
#> [85] "#FF2900" "#FF1F00" "#FF1400" "#FF0A00" "#FF0000" "#F50000" "#EB0000"
#> [92] "#E00000" "#D60000" "#CC0000" "#C20000" "#B80000" "#AD0000" "#A30000"
#> [99] "#990000" "#8F0000"
#> attr(,"type")
#> [1] "continuous"
#>
#> $Chinese
#> [1] "#B0D5DF" "#1772B4" "#ADD5A2" "#41AE3C" "#F091A0" "#C91F37" "#FEDA5A"
#> [8] "#F9BD10" "#FA8C35" "#ED5736" "#B0A4E3" "#A35C8F"
#> attr(,"type")
#> [1] "discrete"
#>
# Include Chinese palettes via prefix
show_palettes(
palette_names = c("ChineseRed", "ChineseBlue"),
return_palettes = TRUE
)
#> $ChineseRed
#> [1] "#F0CFE3" "#F3D3E7" "#F9D3E3" "#E7CAD3" "#EDD1D8" "#F0C9CF" "#EFC4CE"
#> [8] "#F1C4CD" "#F6BEC8" "#EEB8C3" "#E3ADB9" "#ECB0C1" "#EEA6B7" "#EBA0B3"
#> [15] "#ED9DB2" "#EC9BAD" "#F0A1A8" "#EEA2A4" "#EB9A9A" "#F19790" "#F1908C"
#> [22] "#F1939C" "#F091A0" "#EC8AA4" "#EF82A0" "#EC7696" "#EA7293" "#E16C96"
#> [29] "#CB5C83" "#CE5E8A" "#D2568C" "#CC5595" "#C35691" "#B95A89" "#CC73A0"
#> [36] "#D276A3" "#DE82A7" "#DE7897" "#DD7694" "#E77C8E" "#DC6B82" "#DD6B7B"
#> [43] "#CE576D" "#C25160" "#C45A65" "#C35C6A" "#B04552" "#C04851" "#BF3553"
#> [50] "#B81A35" "#C02C38" "#BC172D" "#C21F30" "#C91F37" "#CC163A" "#D70440"
#> [57] "#F03752" "#EE3F4D" "#D9333F" "#CF002D" "#D11A2D" "#DE1C31" "#E61030"
#> [64] "#ED3333" "#ED3B2F" "#E8382C" "#DC3023" "#D42517" "#DE2A18" "#ED3321"
#> [71] "#F13C22" "#F03F24" "#F23E23" "#F33B1F" "#F5391C" "#F1441D" "#F34718"
#> [78] "#F2481B" "#F04B22" "#ED5126" "#F35336" "#ED5736" "#F15642" "#F05A46"
#> [85] "#F25A47" "#F04A3A" "#ED4845" "#EE2746" "#FF2D51" "#F00056" "#EC2C64"
#> [92] "#ED2F6A" "#EF3473" "#EB3C70" "#EB507E" "#EA517F" "#EC4E8A" "#EF498B"
#> [99] "#DE3F7C" "#D13C74" "#D2357D" "#B83570" "#A73766" "#B0436F" "#C5708B"
#> [106] "#BB7A8C" "#C27C88" "#CE8892" "#CF929E" "#E2A2AC" "#D993AB" "#D9A0B3"
#> [113] "#E3B4B8" "#DAA9A9" "#EFAFAD" "#F2B9B2" "#F0ADA0" "#EFAA9C" "#EEA08C"
#> [120] "#F4C7BA" "#F6CEC1" "#F8EBE6" "#F2CAC9" "#E4B8D5" "#EB6EA5" "#EC2D7A"
#> [127] "#EE2C79" "#EE4866" "#EE4863" "#EF475D" "#ED556A" "#ED5A65" "#F47983"
#> [134] "#EF7A82" "#F07C82" "#F17666" "#BD482C" "#BD482A" "#B93A26" "#B13B2E"
#> [141] "#AB372F" "#AF2E2B" "#A72126" "#A61B29" "#AB1D22" "#AC1F18" "#C12C1F"
#> [148] "#C83C23" "#CF4813" "#D85916" "#E16723" "#CD6227" "#A6522C" "#954024"
#> [155] "#8F3D2C" "#873424" "#95302E" "#8F1D22" "#82111F" "#7C191E" "#7C1823"
#> [162] "#82202B" "#822327" "#631216" "#662B1F" "#622A1D" "#4C1E1A" "#662B2F"
#> [169] "#894E54" "#9E4E56" "#A7535A" "#9E2A22" "#C8161D" "#EC2B24" "#EB261A"
#> [176] "#E60012" "#FF3300" "#F43E06" "#E94709" "#62102E" "#FF0097"
#> attr(,"type")
#> [1] "discrete"
#>
#> $ChineseBlue
#> [1] "#D2F0F4" "#C6E6E8" "#B0D5DF" "#A2D2E2" "#85C0DB" "#8ABCD1" "#8FB2C9"
#> [8] "#93B5CF" "#8AABCC" "#8BA3C7" "#88ABDA" "#6E9BC5" "#619AC3" "#5698C3"
#> [15] "#4994C4" "#2486B9" "#1781B5" "#2983BB" "#1177B0" "#1677B3" "#2B73AF"
#> [22] "#3271AE" "#2474B5" "#2376B7" "#2177B8" "#1772B4" "#126BAE" "#1661AB"
#> [29] "#0F59A4" "#15559A" "#2A5390" "#2E4E7E" "#22406A" "#06436F" "#144A74"
#> [36] "#12507B" "#354E6B" "#45465E" "#454659" "#535164" "#6B798E" "#5E7987"
#> [43] "#4182A4" "#4E7CA1" "#346C9C" "#3170A7" "#11659A" "#106898" "#158BB8"
#> [50] "#2F90B9" "#1A94BC" "#22A2C3" "#5CB3CC" "#63BBD0" "#3CBEE7" "#66A9C9"
#> [57] "#A3BBDB" "#AED0EE" "#BCD4E7" "#BACCD9" "#C3D7DF" "#D0DFE6" "#C7D2D4"
#> [64] "#93D5DC" "#3EEDE7" "#30DFF3" "#126E82" "#134857" "#21373D" "#132C33"
#> [71] "#1C2938" "#142334" "#101F30" "#131824" "#0F1423" "#1A2847" "#12264F"
#> [78] "#19325F" "#003460" "#003D74" "#1C3F73" "#213A70" "#003371" "#004EA2"
#> [85] "#26499D" "#424D99" "#4F64AE" "#5976BA" "#6F94CD" "#8D93C8" "#4B5CC4"
#> [92] "#38308E"
#> attr(,"type")
#> [1] "discrete"
#>