[R] 2D and 3D graphing

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Thu Mar 26 19:38:55 CET 2020


" I have attached a .zip with some sample data and a list of R
terminal commands..."

Maybe to Ek, but not to the list. The server strips most attachments.

Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Thu, Mar 26, 2020 at 10:04 AM LMH <lmh_users-groups using molconn.com> wrote:
>
> I have attached a .zip with some sample data and a list of R terminal commands. This
> is not very interactive by does create a useful 3D plot. The data that I used was
> generally not very large.
>
> In the sample commands "R_terminal_input.txt", the working directory is given as
> "C:/rgl_test". Line 14 in the terminal commands sets the working directory location,
> so edit that line if you are going to use a different location. If you just copy the
> entire file with select all | copy and paste it into the R terminal you should get
> the plot (as long as pwd is correct). Make sure to key "enter" after you paste or you
> will not get the last line of code.
>
> You will see a plot of 5 points (5,57,55,41,sum) which are all connected by lines.
> You can rotate the plot with left-click, pan the plot with right-click, and zoom with
> the scroll wheel. The color of the data point is governed by the value of the "class"
> column in the input file.
>
> The input data input is spreadsheet like and you should be able to add your own data
> without too much difficulty.
>
> The format for the connecting lines is in the file
> "connections_5,57,55,41,sum_all.txt" and is in the format,
>
> x0      x1      y0      y1      z0      z1
>
> Each line in the file is a vector where columns 0,2,4 are the xyz coordinates for the
> tail of the vector and columns 1,3,5 are the xyz coordinates for the tip.
>
> I have included a little script "_make_connect.sh". I wrote this to generate the
> connection rows from the input file. The first argument to the script is the input
> file name. The second argument specifies one of three types of connection sets.
>
> all -> all points are connected
> vec -> creates a vector from the first row to each other row
> tet -> creates in irregular tetrahedron connection all points except the first row
>
> This was all created for something I was working on and I don't know how directly it
> will apply to what you need.
>
> Feel free to ask questions. It is probably easier to do that than for me to
> anticipate all possible areas of confusion.
>
> LMH
>
>
>
> EK Esawi 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.
> >
> >
>
> ______________________________________________
> 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