我正在使用包scatterplot3d制作一个三维图形, 但是我需要图表的另一个维度。 我想根据第四个变量的数字vaule来增加散点图内每个点的大小。 是否可能?
我的情节代码是:
library(scatterplot3d)
with(masad, {
s3d <- scatterplot3d(HLC, cites, E.publications,
color=title, pch=19,
angle=20,
main="English",
xlim=c(0,1),
xlab="HLC",
ylab="cites",
zlab="E.publications")
s3d.coords <- s3d$xyz.convert(HLC, cites, E.publications)
legend("topright", inset=.10,
bty="n", cex=.5,
title="title",
c("none/else","doctor","professor") , fill=c("red",
"blue", "darkgreen"))
})
答案 0 :(得分:2)
这是一种方法
library(scatterplot3d)
library(plotrix) # for rescale()
with(mtcars,
scatterplot3d(disp,
hp,
wt,
cex.symbol = rescale(qsec, c(.5, 5)), # .5 <= size <= 5
color = "#00000066", # overplotting, so add transparency
pch = 19)
)