简体   繁体   中英

adding another dimension to a 3d plot with scatterplot3d package

I'm working on a 3d graph with the package scatterplot3d, but I need another dimension to the graph. I would like to increase the size of each point inside the scatter plot, according to a numeric vaule of a fourth variable. IS IT POSSIBLE?

my code for the plot is:

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

     }) 

Here's one way to do it

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM