3d Scatter Plots in RStudio

Home Forums Analytics / Predictive Analytics 3d Scatter Plots in RStudio

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8900
    MathIsYourFriend
    Participant

    I’m using the version of R that will used for the April exam and I’m using the Actex manual.  I ran the chunk below, but not seeing any 3d scatter plot.  I’ve tried uploading different packages, making my plot window bigger, but after running this chunk, *nothing* happens–no error messages, either.

    install.packages(“car”)
    install.packages(“rgl”)
    library(car)
    library(rgl)
    scatter3d(sales ~ TV + radio, data = ad)

    #9785
    Jerry Tuttle
    Participant

    Did you load scatterplot3d?   Where is your dataframe ad?

    Here is one chunk of code that worked for me.

    library(scatterplot3d)
    df <- data.frame(workload=c(1,2,-1,2,0),
    dist2work=c(.2,0,.1,.2,-.4),
    salary=c(1.2,.3,-1,-.1,-.4))
    rownames(df) <- c(“Smith”,”Johnson”,”Williams”,”Jones”,”Davis”)
    s3d <- scatterplot3d(df, angle=55, pch=16, color=”blue”, main=”3D Scatter Plot”)
    text(s3d$xyz.convert(df), labels=rownames(df), cex=1.2, col=”black”)
    model <- lm(salary ~ workload + dist2work, df)
    s3d$plane3d(model)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.