forked from mpjimenez/Stat331-Final_Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPie_Charts.Rmd
43 lines (31 loc) · 916 Bytes
/
Pie_Charts.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
title: "R Notebook"
output: html_notebook
---
This portion works
[ggplot pie chart](http://www.sthda.com/english/wiki/ggplot2-pie-chart-quick-start-guide-r-software-and-data-visualization)
```{r}
library(ggplot2)
library(scales)
bp<- ggplot(washington_crimes, aes(x="Crime", y=Count, fill=Crime))+
geom_bar(width = 1, stat = "identity")
bp
pie <- bp + coord_polar("y", start=0) + scale_fill_brewer(palette="Paired")
pie
```
This portion still has issues
```{r}
blank_theme <- theme_minimal()+
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
panel.border = element_blank(),
panel.grid=element_blank(),
axis.ticks = element_blank(),
plot.title=element_text(size=14, face="bold")
)
pie + blank_theme +
theme(axis.text.x=element_blank()) +
geom_text(aes(y = Count/10 + c(0, cumsum(Count)[-length(Count)]),
label = percent(Count/100)), size=5)
```