我可以告诉ggpairs使用日志秤吗?

Kar*_* W. 10 r ggplot2

我可以ggpairs在GGally包中为函数提供一个参数,以便为某些变量而不是所有变量使用对数标度吗?

Jea*_*ert 10

您不能提供这样的参数(原因是创建散点图的函数是预定义的,没有比例,请参阅参考资料ggally_points),但您可以使用getPlot和更改比例putPlot.例如:

custom_scale <- ggpairs(data.frame(x=exp(rnorm(1000)), y=rnorm(1000)),
upper=list(continuous='points'), lower=list(continuous='points'))
subplot <- getPlot(custom_scale, 1, 2) # retrieve the top left chart
subplotNew <- subplot + scale_y_log10() # change the scale to log
subplotNew$type <- 'logcontinuous' # otherwise ggpairs comes back to a fixed scale
subplotNew$subType <- 'logpoints'
custom_scale <- putPlot(custom_fill, subplotNew, 1, 2)
Run Code Online (Sandbox Code Playgroud)