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

Definable color palette #15

Open
SebastianHesse opened this issue Jan 10, 2023 · 2 comments
Open

Definable color palette #15

SebastianHesse opened this issue Jan 10, 2023 · 2 comments

Comments

@SebastianHesse
Copy link

It would be amazing if one could define the color palette for the plots. Any chance you will implement this in a new version?

Thanks a lot!

@biga94
Copy link

biga94 commented Jan 29, 2024

I was able to correct the PieDonut() function in order to make it possible to define the color palette:
First off, I decided to sideline the makeSubColor function. That part was initially there to create different shades for the donut's subgroups, but I figured since I wanted the pie (yeah, the inner circle) and the donut (the outer ring) to rock the same colors, there was no point in keeping different shades for the subgroups. Made sense to keep it simple.

Then, I went straight to simplifying how colors are handled for both the pie and donut sections. I've added the customColors parameter to directly set up the mainCol. This way, I'm applying the exact same custom color mapping to both parts of the chart, ensuring they're in sync, color-wise.

Finally, I tweaked the geom_arc_bar calls. I replaced the fill parameter from "no" – which was a bit of a placeholder and didn't do much – to actually use the grouping variable, which in my case is pies. This move made sure the colors I specified in customColors are now correctly showing up on both the pie and donut parts. Before this change, the donut part was showing up all gray because it wasn't getting the right instructions on what colors to display. Now, it's looking exactly how I wanted.

So you'll have to create a color mapping according to your grouping factor and then assign to customColors function parameter this mapping object.

@biga94
Copy link

biga94 commented Jan 29, 2024

I've produce a pull request according to what written above. #22

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