Analysis in R: Different Colors, Different Colors, Different Colors! The “randomcoloR” package

Color not only affects the quality of materials, but is also profound, expressing feelings such as liking, disliking, and melancholy. We would like to introduce a package that allows you to create such “colors” randomly.

The following is an introduction to the “scales” package used in the “Execute command”. This package is recommended for expressing colors.

・Analysis in R: “sales” package
 https://www.karada-good.net/analyticsr/r-109/

Package version is 1.1.01. R version 4.2.2 is confirmed.

Install Package

Run the following command.

#Install Package
install.packages("randomcoloR")

Execute command

See the command and package help for details.

#Loading the library
library("randomcoloR")

#Needed to plot colors
#Install the scales package if not already present
if(!require("scales", quietly = TRUE)){
  install.packages("scales");require("scales")
}

#Getting a random color: distinctColorPalette command
#See also:http://tools.medialab.sciences-po.fr/iwanthue/theory.php
#Set the number of acquisitions:k option
CleateCol <- distinctColorPalette(k = 81)
#plot
show_col(CleateCol, labels = FALSE, borders = "#a87963")

#Random color acquisition:randomColor command
#Number of colors to create:count option
#Specify the hue of the color:hue option;"random","red","orange","yellow",
#"green","blue","purple","pink","monochrome"
#Specify the luminosity of the color:luminosity option;"random","light","bright","dark"
RandomCol <- randomColor(count = 6, hue = "blue", luminosity = "light")
#check
RandomCol
[1] "#80abed" "#a9e7fc" "#84e9f4" "#78d3ed" "#8a8aea" "#96ddea"
#plot
show_col(RandomCol, labels = TRUE, borders = "#a87963")

Output Examples

・distinctColorPalette command

distinctColorPalette

・randomColor command

randomColor

I hope this makes your analysis a little easier !!

価格および発送可能時期は、変更される場合があります。購入時には、商品詳細ページに表示されている価格および発送可能時期が適用されます。
本サイト上に表示されるコンテンツは、Amazonによって提供されています。このコンテンツは、現状のまま提供され、変更または削除される場合があります。
Amazonのアソシエイトとして、からだにいいものは適格販売により収入を得ています。
Copied title and URL