1
I have the following data
dados
B Freq
1 Feminino 61.54
2 Masculino 38.46
With the code below I graph a pizza using the package ggplot2
:
library(ggplot2)
library(hrbrthemes)
dados <- data.frame(B = c("Feminino", "Masculino"),
Freq = c(61.54, 38.46))
(graf_B <- ggplot(dados, aes(x ="", y=Freq, fill=B)) +
geom_bar(width = 1, stat = "identity") +
coord_polar("y", start = 0, direction =1) +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
panel.border = element_blank(),
panel.grid=element_blank(),
axis.ticks = element_blank(),
panel.background = element_blank(),
axis.text.x=element_blank(),
legend.title = element_blank(),
plot.title=element_text(size=14, face="bold")) +
geom_text(data = dados,
aes(x ="", y=Freq, label = rotulo),
position = position_stack(vjust = 0.5)) +
labs(title = "Gênero",
subtitle = "",
x="",
y="",
fill="")+
theme_ipsum(plot_title_size = 12,
axis_title_size = 10))
I really liked this theme, but I would like to know if there is the possibility of centralizing the title. I have tried and failed.
Thanks Marcus. Ball show.
– Fidel Henrique Fernandes
It’s great to know that my response has helped you in some way. So consider vote and accept the answer, so that in the future other people who experience the same problem have a reference to solve it.
– Marcus Nunes