在 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 轴(重量)。我知道axis.break
图书馆里有plotrix
,但我如何将它与scatterplot3d
?