I’d like to know how is possible to make a qqplot with ggplot2 that compares two distributions and not a distribution to a theoretical distribution.
I want something like this;
qqplot(iris$Petal.Length, iris$Petal.Width)
that compares the quartiles of Petal.Length and Petal.Width in iris dataset, but using ggplot2.
>Solution :
One easy way to reproduce the plot is to convert the qqplot call to a dataframe and then plot it with ggplot2:
qq <- as.data.frame(qqplot(iris$Petal.Length, iris$Petal.Width, plot.it = FALSE))
ggplot(qq) +
geom_point(aes(x = x, y = y))
