具有ggpairs
函数,如何将较低的切面范围限制为例如x和y是0.5?
library(GGally)
xy <- data.frame(matrix(runif(4 * 1000), ncol = 4))
ggpairs(xy)
答案 0 :(得分:2)
您需要定义一个绘图功能(一个方面)。您可以在这里疯狂使用ggplot
。参见this similar question。
limitRange <- function(data, mapping, ...) {
ggplot(data = data, mapping = mapping, ...) +
geom_point(...) +
geom_smooth(method = "lm", se = FALSE) +
scale_y_continuous(limits = c(0, 0.5)) +
scale_x_continuous(limits = c(0, 0.5))
}
# This is how you specify which part of the image will be
# plotted using your function.
ggpairs(xy, lower = list(continuous = limitRange))