In this post, we take a look at how to use RGL Package in R. RGL package is used to draw the graphics and visualization. The GL is from the OPENGL package. Some of the previous packages had it as a side load package but RGL uses Open GL as a primary package.
Previously I covered the Haven package. Which was used for some of the file import and read. So those files used to be foreign and pretty good. I think some of such packages are often useful when you are reading the external files for content and displaying that data.
Let's also download the RStudio IDE. That is what we are using for most of the tutorials that I have made so far. I also documented the video usage of the RStudio so you have something to look over as well.
I have created a video to give you an overview on how to use the RGL Package for the data science work. You should give this one a try.
Let's start by first installing the package and then using the package for doing our computation. Some of the times that would be worth trying out as well. It goes into next into the example with some data to show you how the plots would look.
So let's start by installing the package and then using it.
It should look something like this in your RStudio IDE. It would be lot easier to view the data once we add it in with IRIS package.
Next thing would be adding the RGL package with the IRIS dataset.
x <- sep.l <- iris$Sepal.Length
y <- pet.l <- iris$Petal.Length
z <- sep.w <- iris$Sepal.Width
Your IRIS dataset should be like this.
As you can see we have imported the IRIS dataset and that package has the capacity to do the work with our simple data plotting for this RGL package. From here we have to call the RGL Package functions.
rgl.points(x, y, z, color ="lightgray")
Now your visualization should look something like this.
Let's say these two functions are added. We are opening the rgl window and then plotting the small scatter plot points using this. And from this point onwards we are going to be taking the code for further 3D visualization.
As you can see there is no limit to how you visualize the data. Various types of plots and the charts are out there that you can try around. And you can view the data in the window of it's own. Considering it's a 3D open GL graphics, you can experiment around with many small data changes and see what works for you.
It's good to see that my tutorials are going good. I managed to finish upto April 2024 worth of content so far. I hope more will follow in near future. I just have to find out some means to continue to make some good content on visualization and the data science.
Expect more tutorials in upcoming months. And also I am going to be pushing scheduled content on youtube upto year 2025. I hope that would help manage my content the right way for the application and hopefully things get set properly.
I hope that you are enjoying some of my R language and data science tutorials. I hope that some of my coverage on this topic would be helpful to you.
If you happen to like this content, do give me feedback over there and that would help me improve my efforts in near future.