You can use plot_grid
from the package cowplot to place plots next to each other. I also specified a few features with theme()
to remove the gray background so the final plot looks more cohesive.
library(tidyverse)
library(cowplot)
method <- data.frame(method = c("violent", "nonviolent"),
accessiblepeople = c(20000,60000))
bar <- ggplot(method, aes(x = method, y = accessiblepeople, fill = method)) +
geom_bar(stat = "identity") + ggtitle("") +
theme_bw() +
theme(legend.position = "none") +
theme(panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(color = "black"))
pie <- ggplot(method_df, aes(x="", y=accessiblepeople, fill=method)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) + theme_void()
plot_grid(bar, pie)
