我只是通过以下情节来到的:

想知道如何在R中完成它? (或其他软件)

更新10.03.11 :谢谢所有参与回答此问题的人-您提供了出色的解决方案!我已经在a post on my blog中编译了这里介绍的所有解决方案(以及我在线上获得的其他解决方案)。

最佳答案

Make.Funny.Plot或多或少做了我认为应该做的事情。要根据自己的需要进行调整,并且可能会有所优化,但这应该是一个不错的开始。

Make.Funny.Plot <- function(x){
    unique.vals <- length(unique(x))
    N <- length(x)
    N.val <- min(N/20,unique.vals)

    if(unique.vals>N.val){
      x <- ave(x,cut(x,N.val),FUN=min)
      x <- signif(x,4)
    }
    # construct the outline of the plot
    outline <- as.vector(table(x))
    outline <- outline/max(outline)

    # determine some correction to make the V shape,
    # based on the range
    y.corr <- diff(range(x))*0.05

    # Get the unique values
    yval <- sort(unique(x))

    plot(c(-1,1),c(min(yval),max(yval)),
        type="n",xaxt="n",xlab="")

    for(i in 1:length(yval)){
        n <- sum(x==yval[i])
        x.plot <- seq(-outline[i],outline[i],length=n)
        y.plot <- yval[i]+abs(x.plot)*y.corr
        points(x.plot,y.plot,pch=19,cex=0.5)
    }
}

N <- 500
x <- rpois(N,4)+abs(rnorm(N))
Make.Funny.Plot(x)

编辑:已更正,因此它始终可以工作。

10-07 12:49
查看更多