如何使用ggpairs在GGally中绘制黄土估计?

我尝试了GGally包装一点。 特别是ggpairs功能。 但是,当情节平滑时,我不知道如何使用黄土而不是lm。 有任何想法吗? 这是我的代码:

require(GGally)
diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),]
ggpairs(diamonds.samp[,c(1,5)], 
        lower = list(continuous = "smooth"),
        params = c(method = "loess"),
        axisLabels = "show")

谢谢!

PS与plotmatrix函数相比,ggpairs要慢得多......因此,大多数情况下,我只是使用ggplot2的plotmatrix。


那么文件没有说,所以使用源,卢克

  • 您可以更深入地了解源代码:

    ls('package:GGally')

    GGally::ggpairs

    ... and browse every function it references ...

    seems like the args get mapped into ggpairsPlots and then -> plotMatrix which then gets called

    所以显然选择平滑器没有明确支持,你只能选择continuous = "smooth" 。 如果它的行为类似于ggplot2:geom_smooth它会自动计算出哪个支持的平滑器要调用(对于<1000数据点,gam为> = 1000)。 您可能想要通过调试器来查看剧情内发生了什么。 我试图追随源头,但我的眼睛釉过。

  • 或2.浏览https://github.com/ggobi/ggally/blob/master/R/ggpairs.r [4/14/2013]

    #' upper and lower are lists that may contain the variables 'continuous',
    #' 'combo' and 'discrete'. Each element of the list is a string implementing
    #' the following options: continuous = exactly one of ('points', 'smooth',
    #' 'density', 'cor', 'blank') , ...
    #'
    #' diag is a list that may only contain the variables 'continuous' and 'discrete'.
    #' Each element of the diag list is a string implmenting the following options:
    #' continuous = exactly one of ('density', 'bar', 'blank');
    
    链接地址: http://www.djcxy.com/p/30911.html

    上一篇: How to draw loess estimation in GGally using ggpairs?

    下一篇: Correlation matrix plot with ggplot2