0

I am plotting a dataset using scatterplot3d and I need to draw a cylinder containing it. What is the easiest way to do that?

An example dataset can be downloaded from here. The cylinder should be centred in (100,100) and have radius 100.

This is the code I am using to plot the points:

library(ggplot2)
library(plotly)
require(plot3D)
library(rgl)
require(gridExtra)
library(scatterplot3d)

Data = read.table("data.txt")
X = as.numeric(unlist(Data[1]))
Y = as.numeric(unlist(Data[2]))
Z = as.numeric(unlist(Data[3]))

# 3D plot
scatterplot3d(X, Y, Z, pch = 16)
albus_c
  • 6,292
  • 14
  • 36
  • 77
  • 3
    Do you already know how to find the "containing" cylinder? What information do you have to do the drawing? It would help if you provided a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with some data to plot and, if possible, a sketch of the desired result – MrFlick Apr 27 '16 at 20:11
  • @MrFlick I included all the info in the question text. Thanks for the tip! – albus_c Apr 27 '16 at 20:24
  • 1
    `scatterplot3d` uses base graphics. I'm not aware that there are handy functions for drawing cylinders isn that plotting paradigm. Also `ggplot2` is famous for its lack of support of 3d graphics. I think you should move your development efforts to `rgl`. (You have loaded packages doing graphics in at least 3 different plotting paradigms, so the end destination of this effort is very unclear.) – IRTFM Apr 27 '16 at 20:51

0 Answers0