【问题标题】:R: scatterplot3d with broken y axisR: scatterplot3d 与断开的 y 轴
【发布时间】:2017-11-25 21:24:10
【问题描述】:

在 R 中,我正在尝试使用以下代码绘制 3D 散点图:

library(scatterplot3d)

mtcars$pcolor[mtcars$cyl==4] <- "red"
mtcars$pcolor[mtcars$cyl==6] <- "blue"
mtcars$pcolor[mtcars$cyl==8] <- "darkgreen"
with(mtcars, {
    s3d <- scatterplot3d(disp, wt, mpg,     
        color=pcolor, pch=19,       
        type="h", lty.hplot=2,      
        scale.y=.75,             
        main="3D",
        xlab="Displacement",
        ylab="Weight",
        zlab="Miles")
     s3d.coords <- s3d$xyz.convert(disp, wt, mpg)
     text(s3d.coords$x, s3d.coords$y,
        labels=row.names(mtcars),     
        pos=4, cex=.5)               

legend("topleft", inset=.05,      
    bty="n", cex=.5,             
    title="Number of Cylinders",
    c("4", "6", "8"), fill=c("red", "blue", "darkgreen"))
})

但现在我想打破 y 轴(重量)。我知道库plotrix 中有axis.break,但是如何将它与scatterplot3d 结合起来?

【问题讨论】:

    标签: r scatter-plot plotrix


    【解决方案1】:

    我不确定这是否可行。根据包文档,“一些 par 参数在这里不适用,例如,许多用于轴计算的参数。”

    可以通过调整刻度标记标签来实现,正如 Scatterplot3d 包的作者在这个答案中看到的那样,但这并没有移动实际的点。 http://r.789695.n4.nabble.com/scatterplot3d-customise-axes-td4554528.html

    最后,我发现这些类型的显示很难解释。考虑格点图方法。

    【讨论】:

    • 谢谢。我自己的数据看起来更清晰一些,最终的想法是在数据上放置一个平滑的平面。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多