问题
This question is combination of R and color-theory
I am trying to order color based on Hue (h), then Saturation (s), and finally Value (v)
Here are the painted colors and dataframe from code at end of this post
Painted
Dataframe
[,1] [,2] [,3] [,4] [,5]
h 0.6229508 0.2767296 0.1323283 0.9790476 0.9093567
s 0.6421053 0.5145631 0.7928287 0.9510870 0.5480769
v 0.3725490 0.8078431 0.9843137 0.7215686 0.4078431
Do I find the color with lowest h value, keep that as 1st position, out of remaining 4 colors, then find the color with lowest hue, and so forth.
Then how would one sort by saturation, then value.
Note, I'm not asking for code, but rather the logic for doing this.
Any guidance is appreciated.
Code
library(RanglaPunjab)
# Paint the colors
PaintPalette("Teej")
# Store the hex values
mycolors <- RanglaPunjab("Teej")
# Print hex values
mycolors
# Convert Hex to RGB
RGBcol <- col2rgb(mycolors)
# Print RGB values
RGBcol
# Convert RGB to HSV
HSVcol <- rgb2hsv(RGBcol)
# Print dataframe
HSVcol
来源:https://stackoverflow.com/questions/51045459/order-color-based-on-hue-saturation-value-in-r