Reputation: 18595
I'm generating a simple pie chart with use of the code below:
data(mtcars)
mtcars$fac_var <- as.factor(mtcars$cyl)
require(ggplot2); require(ggthemes)
# Chart
pie_test <- ggplot(mtcars, aes(x = factor(1), fill = fac_var)) +
geom_bar(width = 1) +
coord_polar(theta = "y") +
ggtitle("Title") +
theme_pander() +
scale_fill_tableau(name = "Something") +
theme(axis.title = element_blank())
The code produces the following chart:
I'm interested in introducing two minor modifications to the chart above:
Upvotes: 1
Views: 372
Reputation: 1143
1.) To get rid of the "1-" edit your theme to:
theme(axis.title = element_blank(),
axis.ticks.y = element_blank(),
axis.text.y = element_blank())
2.) To change the lines edit your theme to:
theme(axis.title = element_blank(),
axis.ticks.y = element_blank(),
axis.text.y=element_blank(),
panel.grid.major.y = element_line(size = 1, color="black", linetype = "solid"))
Not a perfect solution but an improvement. Pie charts are not the best for conveying data. You may want to consider a bar chart. If you want more help with ggplot2 pie charts check out this post.
Upvotes: 1