Title: | Compare Big Datasets to the Uniform Distribution |
---|---|
Description: | A quantile-quantile plot can be used to compare a sample of p-values to the uniform distribution. But when the dataset is big (i.e. > 1e4 p-values), plotting the quantile-quantile plot can be slow. geom_QQ uses all the data to calculate the quantiles, but thins it out in a way that focuses on points near zero before plotting to speed up plotting and decrease file size, when vector graphics are stored. |
Authors: | Robert Corty [aut, cre] |
Maintainer: | Robert Corty <[email protected]> |
License: | GPL-3 |
Version: | 0.1.5 |
Built: | 2025-03-05 03:16:16 UTC |
Source: | https://github.com/rcorty/ggqqunif |
geom_QQ_unif
geom_QQ_unif(mapping = NULL, data = NULL, geom = "point", position = "identity", show.legend = NA, inherit.aes = TRUE, keep_first_n = 1024, step = 8, sorted = FALSE)
geom_QQ_unif(mapping = NULL, data = NULL, geom = "point", position = "identity", show.legend = NA, inherit.aes = TRUE, keep_first_n = 1024, step = 8, sorted = FALSE)
mapping |
Default list of aesthetic mappings to use for plot. If not specified, must be suppled in each layer added to the plot. |
data |
Default dataset to use for plot. If not already a data.frame, will be converted to one by fortify. If not specified, must be suppled in each layer added to the plot. |
geom |
Specify which geom to plot – 'point' and 'line' are the two choices that make sense. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
show.legend |
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. |
inherit.aes |
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification. |
keep_first_n |
Keep the first n p-values (closest to 0). |
step |
How many points to plot with each doubling, e.g. between 1/8 and 1/4, between 1/4 and 1/2, etc. |
sorted |
logical. Are the p-values already sorted? |
a ggplot
library(ggplot2) library(dplyr) set.seed(27599) d <- data.frame(s = runif(n = 5e3)) d %>% ggplot(mapping = aes(sample = s)) + geom_QQ_unif() + scale_x_QQ() + scale_y_QQ() + theme_minimal()
library(ggplot2) library(dplyr) set.seed(27599) d <- data.frame(s = runif(n = 5e3)) d %>% ggplot(mapping = aes(sample = s)) + geom_QQ_unif() + scale_x_QQ() + scale_y_QQ() + theme_minimal()
Scale the axes to show negative log 10 of the p-values.
scale_x_QQ() scale_y_QQ()
scale_x_QQ() scale_y_QQ()