I study my path through ggplot2, and I used it to use polar coordinates and create pie charts, and I ran into some problems.
I want to create a pie chart that does not have a zero or zero axis. The sample code that I have that I thought should work:
data = data.frame(Category = c("A", "B", "C", "D"), Value = runif(4)) ggplot(data, aes(0, weight = Value, fill = Category)) + scale_x_continuous(breaks = NA) + scale_y_continuous(breaks = NA) + geom_bar(binwidth = 1) + coord_polar(theta = "y") + scale_fill_brewer(pal = "Set1")
This code gives me an error:
Error in if (ends_apart < 0.05) { : argument is of length zero
Omitting the breaks argument in the scale_y_continuous function results in a successful plot, with the exception of numbering and radius marking of the pie chart. Omitting the coord_polar function (and leaving the breaks argument to scale_y_continuous), the result is a bar graph without numbering or tick x or y.
I found several solutions related to changing label parameters, and this should be a great workaround, but I was curious why I get this error.
As a side note: I uninstalled and reinstalled ggplot2 to make sure I have the latest version installed and all the checksums match.
Edit: To clarify what I need, it is something like:
plot
except numbering in a pie chart.
source share