I would like to add legend to my scatterplot3d. I created 3 separate plot and overlay them into 1 plot so i don't know where the syntax for legend("topleft",inset=0.5) should go
Plot <-scatterplot3d(data$Size,data$Pct,data$bias1, type='h', zlim=c(-20,100), xlab="size", ylab= "Percent", zlab="Bias")
Plot$points3d (data$Size,data$Pct,data$Bias2,
col="blue", type="h", pch=15, cex=.6)
Plot$points3d(data$Size,data$Pct,data$Bias3,
col="red", type="h", pch=4, cex=.6)
The function scatter3d() uses the rgl package to draw and animate 3D scatter plots.
Creating 3D Plots in R Programming – persp() Function The persp() function which is used to create 3D surfaces in perspective view. This function will draw perspective plots of a surface over the x–y plane. persp() is defines as a generic function.
It's an old question. But I had the same issue and solved it with the following code. I have four timeseries with a duration of a year in a 3D plot.
As usual, I created the graphic like this:
s3d <- scatterplot3d(...)
And then just added the legend like this:
legend(s3d$xyz.convert(18, 0, 12), col= c("green","blue", "red", "black"), bg="white", lty=c(1,1), lwd=2, yjust=0, legend = c("2010", "2011", "2012", "Prognose für 2013"), cex = 1.1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With