QQ图:两个以上的数据 [英] QQ plot: More than two data
本文介绍了QQ图:两个以上的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想绘制类似于此图片的QQ图:
I wanted to graph a QQ plot similar to this picture:
我设法使用两个样本获得了一个QQ图,但是我不知道如何在该图上添加第三个图. 这是我的结果:
I managed to get a QQ plot using two samples, but I do not know how to add a third one to the plot. Here is my result:
这是我使用的代码:
qqplot(table$Bedouin, table$Tunisia, xlim = c(-0.25,0.25), ylim = c(-025,0.25))
在表格数据框中,我还要添加其他人群.但是我不能.
In my table data frame I have other populations I would like to add. But I can't.
谢谢.
推荐答案
我想您正在查找排序值的散点图,因为所有变量都存储在同一数据帧中.
I suppose you're looking for a scatterplot of sorted values since all variables are stored in the same data frame.
示例数据集:
set.seed(10)
dat <- data.frame(A = rnorm(20), B = rnorm(20), C = rnorm(20))
这是一种使用基本R函数创建图的方法:
This is a way to create the plot with basic R functions:
# create a QQ-plot of B as a function of A
qqplot(dat$A, dat$B, xlim = range(dat), ylim = range(dat),
xlab = "A", ylab = "B/C")
# create a diagonal line
abline(a = 0, b = 1)
# add the points of C
points(sort(dat$A), sort(dat$C), col = "red")
# create a legend
legend("bottomright", legend = c("B", "C"), pch = 1, col = c("black", "red"))
这篇关于QQ图:两个以上的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文