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

Waffle chart with 2 categories and raw counts fills out final column with a mysterious 3rd category of made up data #77

Closed
chhamso opened this issue Aug 27, 2020 · 1 comment

Comments

@chhamso
Copy link

chhamso commented Aug 27, 2020

Trying to make a waffle chart of raw counts and only two categories. For some reason it makes up enough counts of a mysterious 3rd category to fill out the final column. With three or more categories the final column is partially filled as I intend. how do I make this work with just two categories?

Stack Overflow link - https://stackoverflow.com/questions/63624502/waffle-chart-with-2-categories-and-raw-counts-fills-out-final-column-with-a-myst

repro

library(waffle)

test2 <- c(`Group A`= 40, `Group B`= 33)
test3 <- c(`Group A`= 40, `Group B`= 33, `Group c` =10)

#test2 fails, test3 works as intended
waffle(test2)  
waffle(test3)

Images below. top image is what I get. Bottom image is what I want but with one less category.

test2
test3

@chhamso
Copy link
Author

chhamso commented Aug 28, 2020

Close
See answer in stack overflow
Stack Overflow link - https://stackoverflow.com/questions/63624502/waffle-chart-with-2-categories-and-raw-counts-fills-out-final-column-with-a-myst

library(waffle)

test2 <- c(`Group A`= 40, `Group B`= 33)

waffle(test2, title = "Historical Benchmark Composition", colors = c(RColorBrewer::brewer.pal(3, "Set2")[1:2]))

works

@chhamso chhamso closed this as completed Aug 28, 2020
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

1 participant