# Creating 3D Graphs with Data in R

Creating 3D graphs  in a 3d scatterplot is a 2 minute task in R using the woderful R Commander GUI. You can see an example video-

I loaded R,                                                                                                                                               then loaded the GUI,                                                                                                                           inputted data (from an attached package) but you can input data from a csv,           then went to Graphs- 3D ScatterPlot.

Here is the result- and here is the video.

Not bad for 2 minutes of clicking a GUI.

Here is the auto generated code by R Commander.

```> data(iris3, package="datasets")
> iris3 <- as.data.frame(iris3)
> names(iris3) <- make.names(names(iris3))
> library(rgl, pos=4)
> library(mgcv, pos=4)
> scatter3d(iris3\$Petal.W..Setosa, iris3\$Petal.L..Setosa, +   iris3\$Sepal.L..Setosa, fit="linear", residuals=TRUE, bg="black", +   axis.scales=TRUE, grid=TRUE, ellipsoid=FALSE, xlab="Petal.W..Setosa", +   ylab="Petal.L..Setosa", zlab="Sepal.L..Setosa")
> scatter3d(iris3\$Petal.L..Versicolor, iris3\$Petal.L..Setosa, +   iris3\$Petal.L..Virginica, fit="linear", residuals=TRUE, bg="white", +   axis.scales=TRUE, grid=TRUE, ellipsoid=FALSE, xlab="Petal.L..Versicolor", +   ylab="Petal.L..Setosa", zlab="Petal.L..Virginica")
> rgl.snapshot("C:/Documents and Settings/abc/Desktop/RGLGraph.png")

``` ## Author: Ajay Ohri

1. Bob Muenchen says:
1. Ajay Ohri says:
{"ft_lang_label":"__label__en","ft_lang_prob":0.56512105,"math_prob":0.7547756,"size":1243,"snap":"2021-31-2021-39","text_gpt3_token_len":399,"char_repetition_ratio":0.15254237,"word_repetition_ratio":0.0,"special_character_ratio":0.28399035,"punctuation_ratio":0.2777778,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9763645,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,5,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-27T16:12:46Z\",\"WARC-Record-ID\":\"<urn:uuid:27a0d535-68bf-48a1-89cc-d83c1fab6631>\",\"Content-Length\":\"298162\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:feb80e18-5b05-4156-8fb4-21df5e4ff161>\",\"WARC-Concurrent-To\":\"<urn:uuid:734cafe6-484f-4d6a-bf80-2fb0a4674ce1>\",\"WARC-IP-Address\":\"192.0.78.25\",\"WARC-Target-URI\":\"https://decisionstats.com/2010/09/30/creating-3d-graphs-with-data-in-r/\",\"WARC-Payload-Digest\":\"sha1:EZU2ZIVVDC5NBV6RC4F7DHUEPD7Y4RHK\",\"WARC-Block-Digest\":\"sha1:SZMPF5TVWPQVYGKXAGL4YA7G2I5ZWIR4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780058456.86_warc_CC-MAIN-20210927151238-20210927181238-00142.warc.gz\"}"}