Before reading any longer, I suggest you to download and see the original codes in this question posted in this forum.
I run this ggplot code:
ggplot(data=data, aes(x=X2, y=Count, group=X3, colour=X3)) +
geom_point(size=5) +
geom_line() +
xlab("Decils") +
ylab("% difference in nº Pk") +
ylim(-50,25) + ggtitle("CL") +
geom_hline(aes(yintercept=0), lwd=1, lty=2) +
scale_x_discrete(limits=c(orden_deciles)) +
coord_polar() +
geom_area(aes(color=X3, fill=X3), alpha=0.2) +
And got this plot:
As you may imagine, something's wrong with the code. Blue group seems to be colored properly. I would like to color all the groups, taking as reference the black-slashed ring, which represent 0.
How can I implement this?
geom_area()
has a defaultposition
argument ofstack
. This stack each area over the others, creating weird results in this case.Simply change the position to
identity
:Created on 2018-05-15 by the reprex package (v0.2.0).