1
에 facet_grid와 위치를 레이블 :조정 데이터가 내가 R이 예를 ggplot2
uf <- c("AC","AC","AC","AC","AC","AC","AC","AC","AM","AM","AM",
"AM","AM","AM","AM","AM")
da <- c("Federal", "Estadual", "Municipal", "Privada","Federal", "Estadual", "Municipal", "Privada","Federal", "Estadual", "Municipal", "Privada","Federal", "Estadual", "Municipal", "Privada")
tr <- c(97,99,90.5,78.6,3,1,9.5,21.4,97.2,99.1,96.8,98.7,2.8,0.9,3.2,1.3)
resposta <- c("resposta","resposta","resposta","resposta","não resposta","não resposta","não resposta","não resposta","resposta","resposta","resposta","resposta",
"não resposta","não resposta","não resposta","não resposta")
taxa <- data.frame(uf, da, tr,resposta)
######_Adjusting data labels position_###############
taxa <- ddply(taxa, .(da), transform, pos = cumsum(tr) - (0.5 * tr)) # Ajusta a posição
g1 <- ggplot()+ geom_bar(aes(y = tr, x = da, fill = resposta), data = taxa,
stat="identity") +
facet_wrap(~uf) +
geom_text(data=taxa, aes(x = da, y = pos, label = tr), size=4) +
theme(legend.position="bottom", legend.direction="horizontal",
legend.title = element_blank())
g1
이 그림 제작 : Question for dependencia with facet for uf
을패키지
다음install.packages("plyr")
library(plyr)
install.packages("ggplot2")
library(ggplot2)
install.packages("ggthemes")
library(ggthemes)
내 코드입니다
이 값을 모든 값으로 생성하고 싶습니다. 바 안에서 그리고 y 축은 100
어떤 도움을 주시면 감사하겠습니다.
안녕 알렉스, 감사합니다. 자, 내 일을 끝낼 수있어. – Tadeu