I am trying to create a 3D scatter plot. I have the following data in a spreadsheet (titles on Row 2, data A3 to E34.
I would like to be able to create a plot that shows RA-RWR-C40 as a 3D plot with sample number as point label and n as point size.
My latest version of code (patched together and I admit poorly understood) gives me error message “Error: unexpected symbol in:” scatter3D”
`library(readxl)
library(dplyr)
library(ggplot2)
file <- file.choose()
data <- read_excel(file, sheet = "Sheet1", range = "A3:E34")
colnames(data) <- c("sample", "RA", "C40", "n", "RWR")
data <- data %>%
mutate(
across(RA:RWR, as.numeric)
scatter3D(x = RA, y = RWR, z = C40, pch = 16, cex = 1.5, xlab = "X", ylab = "Y", zlab = "Z", clab = c("not sure"), main = "TITLE", ticktype = "detailed", theta = 10, d = 2, colkey = list(length = 0.5, width = 0.5, cex.clab = 0.75)))
ggsave(file.path("C:\Users\sedeal\Downloads", paste0(basename(file), ".jpg"))
`
Latest error message is Error: unexpected symbol in: " scatter3D"
.. and no plot!
Clearly, I am doing something fundamentally stupid, but if I try to run through the documentation on plot3D : Tools for plotting 3-D and 2-D data and then try the code I end up getting more error messages and more confused!
COULD ANYONE PLEASE POINT ME TO A BEGINNERS TUTORIAL / help me understand where I am going wrong?? 🙂
thank you!