I'm making a piechart using ggplot2 and it looks fine in RStudio:
data <- data.frame(
continent=c("Europe", "N. America", "S. America", "Asia", "Africa", "Australia"),
value=c(80, 30, 20, 110, 40, 5)
)
library(ggplot2)
ggplot(data, aes(x="", y=value, fill=continent)) +
geom_bar(stat="identity", width=1, color="black")+
coord_polar("y") +
theme_void()
ggsave("piechart.png")
However, when I open the saved picture, you can see that the center has an unwanted spike from the green segment:
I feel this looks rather bad. Can I remove it somehow? Maybe change the line thickness so this is not as pronounced?
Edit
Setting the linejoin to 'bevel' helps w/o fiddling around with inner radius as in previous approach:
library(ggplot2)
ggplot(data, aes(x="", y=value, fill=continent)) +
geom_bar(stat="identity", width=1, color="black",
linejoin = 'bevel'
)+
coord_polar("y") +
theme_void()
You could use coord_radial
instead of coord_polar
, prevent axis expansion and set a minute inner radius:
ggplot(data, aes(x="", y=value, fill=continent)) +
geom_bar(stat="identity", width=1, color="black")+
coord_radial('y', expand = FALSE, inner.radius = 0.01) +
theme_void()