r - 如何在 R 中标记散点图的点?
问题描述
我有一个包含约 10000 行和 3 列的数据框:
ENSEMBL J1.1 J1.2
ENSG00000166710 800 900
ENSG00000163220 15000 32500
ENSG00000156508 600 900
...
> as.data.frame(colnames(TPMProtCod_J1.1_J1.2))
colnames(TPMProtCod_J1.1_J1.2)
1 ENSEMBL
2 J1.1
3 J1.2
> dim(TPMProtCod_J1.1_J1.2)
[1] 10602 3
我用以下代码创建了一个散点图:
plot(TPMProtCod_J1.1_J1.2$J1.1, TPMProtCod_J1.1_J1.2$J1.2, col = "lightblue", pch=19, cex=2, xlab = "J1.1 (TPM)", ylab = "J1.2 (TPM)")
text(TPMProtCod_J1.1_J1.2$J1.1, TPMProtCod_J1.1_J1.2$J1.2, labels = row.names(TPMProtCod_J1.1_J1.2), cex= 0.9)
但是如何使每个点显示相应的集成 ID 而不是行号?
解决方案
看来您需要更改row.names(...)
为TPMProtCod_J1.1_J1.2$ENSEMBL
:
text(TPMProtCod_J1.1_J1.2$J1.1, TPMProtCod_J1.1_J1.2$J1.2, labels = TPMProtCod_J1.1_J1.2$ENSEMBL, cex= 0.9)
推荐阅读
- python - Python 资源文件管理
- sql - 在 MS-Access 查询上使用具有两个联接的别名
- ruby-on-rails - 从 CSV 创建两个模型
- bash - 如何匹配文件中两个字符串之间的字符串并使用sed操作匹配的字符串?
- android - 显示后编辑 CustomViewGroup (RelativeLayout) (Android)
- python-3.x - 井字游戏无法识别获胜者
- java - 使用 scrollFlags 时自定义工具栏不隐藏
- java - 如何验证字符串集合和每个元素作为 URL?
- angular - “使用 gridOptions 更新 ag-grid”
- dart - 我应该为颤振形式的每个输入字段创建一个单独的控制器吗?