Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create custom RColorBrewer palette? #36

Open
lejarx opened this issue Mar 18, 2021 · 1 comment
Open

How to create custom RColorBrewer palette? #36

lejarx opened this issue Mar 18, 2021 · 1 comment

Comments

@lejarx
Copy link

lejarx commented Mar 18, 2021

I want to change the color scale based on a hex code color I provide.

For example below the color_scale argument takes a value based on available color palette from RColorBrewer library

library(bupaR)
patients %>%
    process_map(type = frequency("relative_case", color_scale = "Purples"))

Is there any way that I can create a custom palette which is not part of the RColorBrewer palette (RColorBrewer::brewer.pal.info) so that it can be an input to the process_map color_scale argument?

For example, I want the color scale to be generated based on this hexcode #004b88.

If I simply replace the hexcode as below, I would get the following error which suggests that I'm only bounded by whatever color palettes provided by RColorBrewer which I think shouldn't be the case

> patients %>%
+     process_map(type = frequency("relative_case", color_scale = "#004b88"))
Error: `colorize_node_attrs()` REASON:
* The color palette is not an `RColorBrewer` or `viridis` palette`()` REASON:
* The color palette is not an `RColorBrewer` or `viridis` palette`()` REASON:
* The color palette is not an `RColorBrewer` or `viridis` palette
@gertjanssenswillen
Copy link
Member

Sorry for the late reply. Not possible at the moment, but can probably by extended.

@gertjanssenswillen gertjanssenswillen transferred this issue from bupaverse/bupaR Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants