本文介绍了如何使用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。 解决方案 div>

那么文档没有说,所以使用源代码Luke


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

    ls('package:GGally')



    GGally :: ggpairs



    。 ..并浏览它引用的每个函数...



    好像args被映射到ggpairsPlots然后 - >然后调用plotMatrix



    因此,显然选择平滑器并不明确支持,您只能选择 continuous =smooth 。如果它的行为类似于 ggplot2:geom_smooth ,它会在内部自动计算出哪些支持的平滑器要调用(对于< 1000数据点,gam for> = 1000)。
    您可能想要通过调试器来查看情节内发生了什么。

  2. ://github.com/ggobi/ggally/blob/master/R/ggpairs.rrel =nofollow> https://github.com/ggobi/ggally/blob/master/R/ggpairs.r [4/14/2013]

     #'上面和下面的列表可能包含变量'continuous',
    #''组合'和'离散'。列表中的每个元素都是一个字符串,实现
    #'以下选项:连续=恰好是'''','平滑',
    ''密度','cor','空白' ),...
    #'
    #'diag是一个只包含变量'continuous'和'discrete'的列表。
    #'诊断列表中的每个元素都是一个字符串,表示以下选项:
    #'continuous =恰好是('density','bar','blank')之一;


    I tried GGally package a little bit. Especially the ggpairs function. However, I cannot figure out how to use loess instead of lm when plot smooth. Any ideas?Here is my code:

    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")
    

    Thanks!

    P.S. compare with the plotmatrix function, ggpairs is much much slower... As a result, most of the time, I just use plotmatrix from ggplot2.

    解决方案

    Well the documentation doesn't say, so use the source, Luke

    1. You can dig deeper into the source with:

      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

      So apparently selecting smoother is not explicitly supported, you can only select continuous = "smooth". If it behaves like ggplot2:geom_smooth it internally automatically figures out which of the supported smoothers to call (loess for <1000 datapoints, gam for >=1000).You might like to step it through the debugger to see what's happening inside your plot. I tried to follow the source but my eyes glaze over.

    or 2. Browse on 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');
    

    这篇关于如何使用ggpairs在GGally中绘制黄土估计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-05 21:27