Generate radar charts with ggplot2

一曲冷凌霜 提交于 2019-12-01 06:15:15

Thanks to @DJack, I post here the result adding + coord_polar():

This is the final 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()

There's a ggplot extension to create radar/spider charts called https://www.ggplot2-exts.org/ggradar.html

For some strange reason, it's expecting the data in wide and not in tidy/long format.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!