r - 如何在 R 图中沿 x 轴绘制 3 个变量?
问题描述
如何将x 轴标记为actual
、knn
和pca
并沿 ? 绘制其各自的值y-axis
?
dat.pca.knn <- rbind(actual, knn, pca)
plot(c(1, ncol(dat)),range(dat.pca.knn),type="n",main="Profile plot of probeset 206054_at\nwith actual and imputed values of GSM146784_Normal",xlab="Actual vs imputed values",ylab="Expression Intensity",axes=F,col="red")
axis(side=1,at=1:length(dat.pca.knn),labels=dimnames(dat.pca.knn)[[2]],cex.axis=0.4,col="1",las=2,tick=T)
axis(side=2)
for(i in 1:length(dat.pca.knn)) {
dat.y <- as.numeric(dat.pca.knn[i,])
lines(c(1:ncol(dat.pca.knn)),dat.y,lwd=2,type="p",col="1")
}
数据
输入(数据[1:2,])
structure(c(1942.1, 40.1, 2358.3, 58.2, 2465.2, 132.6, 2732.9,
64.3, 1952.2, 66.1, 2048.3, 69, 2109, 109.7, 3005.1, 59.4, 2568.1,
81.7, 2107.7, 100.8, 1940.2, 170.1, 2608.8, 186.7, 1837.2, 103.8,
1559.2, 86.8, 2111.6, 86, 2641, 152.7, 1972.7, 124.8, 1737.2,
115, 1636.1, 202.1, 2718.4, 257.3), .Dim = c(2L, 20L), .Dimnames = list(
c("1007_s_at", "1053_at"), c("GSM146778_Normal", "GSM146780_Normal",
"GSM146782_Normal", "GSM146784_Normal", "GSM146786_Normal",
"GSM146789_Normal", "GSM146790_Normal", "GSM146792_Normal",
"GSM146794_Normal", "GSM146796_Normal", "GSM146779_Tumor",
"GSM146781_Tumor", "GSM146783_Tumor", "GSM146785_Tumor",
"GSM146787_Tumor", "GSM146788_Tumor", "GSM146791_Tumor",
"GSM146793_Tumor", "GSM146795_Tumor", "GSM146797_Tumor")))
dat.pca.knn
> print(dat.pca.knn)
[,1]
actual 8385.300
knn 7559.533
pca 10418.002
解决方案
推荐阅读
- powershell - 如何使用 powershell 脚本在日志文件中附加新行文本?
- windows - Python 2.7.16 安装卡住
- android - 在邀请分享 url 到社交媒体渠道时,应用程序从最近打开/正在运行的应用程序列表中移开
- javascript - 在livetable php中重复JS警报
- python - 如何从 CSV 文件检查列标题在 Python 中是否有效
- oauth - 如何从 saml 请求中进行 openid 调用
- javascript - 如果它已在子类中被覆盖,如何访问原始基类方法?
- c# - 从 OpenGL 控件中删除纹理以外的区域 - c# opentk
- php - 如何将 HTML 插入 Summernote 所见即所得编辑器?
- c - C 线性搜索无法使用 strcmp 比较两个字符串,编译正常