여러 조각으로 파이 차트를 만들려고하고 있으며 그 중 많은 차트에 작은 값이 있습니다. 문제는 차트를 만들 때 대부분의 레이블이 서로 겹치는 것입니다.원형 차트 레이블 겹침 ggplot2
데이터 :
Descripcion Freq
Sumarios 17
Previsiones Legales 34
Multas SICORE 19
Multas ANSeS 7
Multas AFIP 5
Gastos Corresponsalía 22
Faltantes de Caja 470
Cargos Jubilaciones 2185
ATM Fraudes 10
ATM Diferencias 201
그리고 코드 :
#armo el grafico
pmas <- ggplot(cant_masivos_trim, aes(x=1, y=Freq, fill=Descripcion)) +
geom_bar(stat="identity") +
ggtitle(paste("Cantidad de Reportes - Carga Masiva"))
pmas <- pmas + coord_polar(theta='y')
pmas <- ggplot(cant_masivos_trim, aes(x=1, Freq, fill=Descripcion)) +
ggtitle(paste("Cantidad de Reportes - Carga Masiva")) +
coord_polar(theta='y')
pmas <- pmas + geom_bar(stat="identity", color='black') + guides(fill=guide_legend
(override.aes=list(colour=NA)))
pmas <- pmas + theme(axis.ticks=element_blank(), # the axis ticks
axis.title=element_blank(), # the axis labels
axis.text.y=element_blank()) # the 0.75, 1.00, 1.25 labels.
y.breaks <- cumsum(cant_masivos_trim$Freq) - cant_masivos_trim$Freq/2
pmas <- pmas +
# prettiness: make the labels black
theme(axis.text.x=element_text(color='black')) +
scale_y_continuous(
breaks=y.breaks, # where to place the labels
labels= (paste(cant_masivos_trim$Freq, percent(cant_masivos_trim$Freq/sum (cant_masivos_trim$Freq)), sep='\n'))) # the labels
내가 여기 해결책을 찾을 수 있지만,이하려고 어떤
그래픽은 이것이다 운. 아무도 아이디어가 있니?
당신이 레이블 또는 텍스트 대신 축 레이블을 추가하는 경우 , 당신의 라인을 따라 뭔가를 할 수 [이] (http://stackoverflow.com/a/33337625/2461552). 또한 ggrepel 패키지를 참조하십시오. 도너츠 예제가 여기에 나와 있습니다 (http://stackoverflow.com/a/38688118/2461552). – aosmith