美文网首页
ggplot-geom_histogram 频数分布直方图

ggplot-geom_histogram 频数分布直方图

作者: 倪桦 | 来源:发表于2022-06-30 17:11 被阅读0次
### 测试数据
> raw_counts
      cell.1 cell.2    cell.3      cell.4 cell.5
Yz707      1   5530 10.096841 0.733589019      1
JtvvP      1   4025  9.441494 0.906189359      2
7INoh      0   3828 10.554613 1.471324220      3

### 处理统计数据
data.plot <- raw_counts %>% mutate(total_expr = rowSums(.),total_expr_log10 = log10(as.numeric(total_expr)) ) %>% 
    tibble::rownames_to_column(var = "featue") %>% data.frame() %>% select(featue,total_expr,total_expr_log10) 
> data.plot
    feature  total_expr total_expr_log10
1     Yz707  5542.83043         3.743732
2     JtvvP  4038.34768         3.606204
3     7INoh  3843.02594         3.584673

出图 : data.plot %>% ggplot(aes(x=total_expr_log10))+geom_histogram(bins = 30,color = "red",fill="skyblue") +theme_bw()

相关文章

网友评论

      本文标题:ggplot-geom_histogram 频数分布直方图

      本文链接:https://www.haomeiwen.com/subject/owofbrtx.html