vtree icon indicating copy to clipboard operation
vtree copied to clipboard

Custom color palette

Open kellytdunn opened this issue 1 year ago • 1 comments

Is there a way to use a custom color palette, defined with hex codes, in vtree? (not part of RColor Brewer). Love this tool. Thanks!

kellytdunn avatar Feb 15 '24 18:02 kellytdunn

Use the specfill argument to provide a list of the valid colors for categorical variables. The list consists of named character vectors of value = hexcolor.

For example, if you had the categorical variables "sex" and "maritalStatus", you could add this parameter to vtree:

specfill = list(sex = c("female="red","male"="blue"), maritalStatus = c("married"="orange",single="green"))

Note that currently, the maximum number of values (colors) for a given variable is 9. I just created an issue report on this and hope it will be changed in the next version.

mac471 avatar Jul 09 '24 02:07 mac471