r - Display hex codes for colours ggplot2 is using -


how can see colors ggplot2 using discrete categories using given palette, "set1" or "set2" brewer? i.e. given set of categories colors used are?

by default use hue_pal defaults. when use scale_x_brewer use brewer_pal defaults (both scales package). you'll many colors palettes have categories. e.g. (using defaults):

f <- hue_pal(h = c(0, 360) + 15, c = 100, l = 65, h.start = 0, direction = 1) f(3) ## [1] "#f8766d" "#00ba38" "#619cff"  f(9) ## [1] "#f8766d" "#d39200" "#93aa00" "#00ba38" "#00c19f" "#00b9e3" "#619cff" "#db72fb" ## [9] "#ff61c3"   g <- brewer_pal(type="seq", palette=1) g(3) ## [1] "#deebf7" "#9ecae1" "#3182bd"  g(9) ## [1] "#f7fbff" "#deebf7" "#c6dbef" "#9ecae1" "#6baed6" "#4292c6" "#2171b5" "#08519c" ## [9] "#08306b" 

you can see brewer_palwill set3 or other named palette using palette parameter.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -