-
Notifications
You must be signed in to change notification settings - Fork 2k
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
rotation direction set up randomly for pie chart. #6250
Comments
The ordering of categorical variables is determined by the data values (alphabetical by default), and since you're using color codes as data values they are used for ordering. I would strongly advise against using Also, this may help: https://wilkelab.org/SDS375/slides/getting-things-in-order.html#1 |
Thanks for your quick reply! But, the data value are 1 for both categories, and I didn't use color codes as data values. the color codes is for color only. Even I changed the value, the output didn't change. Please take a further look of this issue. @clauswilke |
I agree with Claus that this is not a bug. These issues here on github are for tracking bugs and feature requests. The issue you've surfaced here is a usage question which would have a better home on stackoverflow or the posit community. |
@teunbrand Can you provide a script to solve the problem if you take this as a usage question? |
This is not the place for that. You've already been directed to more resources by Claus: https://wilkelab.org/SDS375/slides/getting-things-in-order.html#1. If these are insufficient to resolve your problem, I'll repeat that a better venue for usage questions is stackoverflow or the posit community. |
Sad that none of you take this as bug. If the function can't generate consistent output, it's a bug. |
it is unclear what are you trying to achieve and what is expected. library(ggplot2)
library(patchwork)
dat1 <- data.frame(year = c("2012", "2019"),
value = c(1, 1),
pie = "one")
dat2 <- data.frame(year = c("2019", "2023"),
value = c(1, 1),
pie="two")
dat <- rbind(dat1,dat2)
ggplot(dat, aes(x = pie, y = value, fill = year)) +
geom_bar(stat = "identity", width = 1) +
facet_grid(~pie,scales="free")+
scale_fill_manual(values=c("#1CF900","#FFA600", "#FF4000")) Created on 2024-12-19 with reprex v2.1.1 |
You did. They're in your data frame. And then you chose to display them, via As I wrote in my first response, |
I found a problem with geom_bar
I expected the brown part of the second pie chart should be on the left, but it didn't.
I found it depends on the order of color code. How to fix it?
Here is the code to reproduce the bug:
The text was updated successfully, but these errors were encountered: