相关疑难解决方法(0)

R堆积百分比条形图,包含二元因子和标签的百分比(使用ggplot)

我想生成一个看起来像这样的图形:

在此输入图像描述

我的原始数据集看起来像这样:

> bb[sample(nrow(bb), 20), ]
      IMG QUANT FIX
25663   1     1   0
7936    2     2   0
23586   3     2   0
23017   2     2   1
31363   1     3   1
7886    2     2   0
23819   3     3   1
29838   2     2   1
8169    2     3   1
9870    2     3   0
31440   2     1   0
35564   3     1   0
24066   1     2   0
12020   3     2   0
6742    3     2   0
6189    2     3   0
26692   2     3   0
1387    3     2 …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

21
推荐指数
1
解决办法
3万
查看次数

geom_text位置在条形图中间

需要帮助对齐条形图上的标签.

这是可重现的代码:

library(ggmap)
library(ggplot2)
library(gganimate)
library(readxl)
library(animation)

mydf1<-structure(list(year = c(1994, 1995, 1997, 1997, 1998, 1998, 2000, 
2000, 2001, 2001, 2002, 2002, 2004, 2005, 2005, 2006, 2006, 2007, 
2007, 2008, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2015, 
2016, 2016, 2016, 2016), N = c(3L, 1L, 1L, 4L, 1L, 4L, 1L, 2L, 
1L, 5L, 1L, 2L, 1L, 1L, 4L, 1L, 3L, 1L, 2L, 1L, 5L, 2L, 2L, 6L, 
4L, 1L, 1L, 2L, 1L, 1L, 3L, 4L, 1L), channels = c(86, …
Run Code Online (Sandbox Code Playgroud)

r bar-chart ggplot2 stackedbarseries

0
推荐指数
1
解决办法
5586
查看次数

标签 统计

ggplot2 ×2

r ×2

bar-chart ×1

stackedbarseries ×1