如何删除由ggplot2生成的饼图中的坐标 [英] How to remove coordinate in pie-chart generated by ggplot2

查看:106
本文介绍了如何删除由ggplot2生成的饼图中的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提供此数据:

abTcells    1456.74119
Macrophages 5656.38478
Monocytes   4415.69078
StemCells   1752.11026
Bcells  1869.37056
gdTCells    1511.35291
NKCells 1412.61504
DendriticCells  3326.87741
StromalCells    2008.20603
Neutrophils 12867.50224

此情节:

是使用以下代码生成的:

Is generated with the following code:

library(ggplot2)                  
df <- read.table("http://dpaste.com/1697602/plain/");
ggplot(df,aes(x=factor(1),y=V2,fill=V1))+
   geom_bar(width=1,stat="identity")+coord_polar(theta="y")

如何删除以下内容:

  1. 圆坐标,例如(0,10000,20000,30000)
  2. Y轴坐标(例如1)
  3. 白色圆圈.

推荐答案

您可以使用 theme :

ggplot(df, aes(x = factor(1), y = V2, fill = V1))+
  geom_bar(width = 1, stat = "identity") +
  coord_polar(theta = "y") +
  theme(axis.text = element_blank(),
        axis.ticks = element_blank(),
        panel.grid  = element_blank())

在删除整个网格之后,您可以使用geom_hlinegeom_vline手动添加自己的网格(请参阅

After the entire grid is removed, you can manually add an own grid, using geom_hline and geom_vline (see here).

我建议您查看> 本教程 .

I recommend having a look in this tutorial.

这篇关于如何删除由ggplot2生成的饼图中的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆