[R] 2D and 3D graphing

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Mar 24 22:59:08 CET 2020


rgl can do that, but I have my doubts whether it is useful:

x <- runif(500)
y <- runif(500)
z <- (x - 0.5)^2 + (y - 0.5)^2

library(rgl)
plot3d(x, y, z, col = "red")
dxyz <- deldir::deldir(x, y, z = z, suppressMsge = TRUE)
plot3d(dxyz, add = TRUE, front = "lines", back = "lines", specular = 
"black")

Duncan Murdoch

On 24/03/2020 5:42 p.m., EK Esawi via R-help wrote:
>   
> Thank you Jeff. I have been using a textbook which has some of the chart types i was hoping to produce; that's 3D charts where points are connected by lines in 3D, like a grid. The book also has 3D fitted surfaces. The authors used exclusively R in this book. That's what i asked.
> Thanks again and hope you and yours are safe
> EK
>      On Monday, March 23, 2020, 11:23:34 PM EDT, Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
>   
>   I don't know of any 3d scatterplot plotting software that does that. You have to communicate the connections between points to the plotting function, and there is no easy way to do that with arbitrary scattered points. That is why the surface3d function interface is separate from the points3d function interface ... it uses a matrix to communicate adjacency for four points at a time.
> 
> On March 23, 2020 7:54:04 PM PDT, EK Esawi via R-help <r-help using r-project.org> wrote:
>>
>> Thank you Ista and LMH.
>> I want to plot 3D scatter with options to connect the surface with
>> lines;that's just like points connected with a  line in 2D and i may
>> want to fit a surface to the data for soem of teh plots. LMH pointed
>> out to what concerned me and the reason for the question which was i
>> don't want to spend time in a package and then find out that t doesn't
>> do what i want to.
>> Thanks again and best of luckEK
>> On Monday, March 23, 2020, 6:02:33 PM EDT, LMH
>> <lmh_users-groups using molconn.com> wrote:
>>
>> Hello,
>>
>> I use rgl for 3D plots.
>>
>> Mostly I use this for a 3D scatter plot where I can zoom and pan for
>> closer analyses
>> of the data. I also can manually connect any points with lines. It took
>> me a bit to
>> get the options right so the plot appears the way I want it to. In my
>> opinion, there
>> are a few unresolved issues with the units and labels on the axis, but
>> most of the
>> data I looked at was in principle components so x, y, and z were in the
>> same units.
>>
>> I can post a sample of the terminal input that I used if that would
>> help.
>>
>> LMH
>>
>>
>> Ek Esawi wrote:
>>> Hi All--
>>>
>>> I have been looking into 2D and 3D graphing packages. Based on what i
>>> read, it seems that ggplot2 is the best and I like it too, but
>> ggplot2
>>> doesn't have 3D plotting capabilities. I read that other packages
>>> (plot_ly, rgl, rayshader) can be used with ggplot2 to create 3D
>>> charts, but not sure if that’s the way to go.
>>>
>>> The question is: what is/are the best 2D and 3D graphing packages? I
>>> read that lattice, and a few others, has “limited” 3D charting
>>> capabilities.
>>>
>>> Thanks in advance--EK
>>>
>>> ______________________________________________
>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>    
>>      [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list