Thursday, 23 January 2014

3-D Interactive Graph

"Graph is not a picture but an analytical tool"

These days computers can perform analysis that used to be done with graphs on grid papers, hence people often do not realise that graphs are actually analytical tools. This means that graph needs to be accurate and relevant. The graph should not be more complex than is necessary, and hence 3-dimensional graphs should be avoided if there are alternate ways to represent it. However, it is sometimes useful to visualise the data in 3 dimensional space, and with the help of computers, we can draw 3 dimensional graph more accurately with high quality. Furthermore, 3 dimensional graphs are visually more impressive and are great for presentations.

In R, there are several packages that enable users to draw 3 dimensional graphs. Among these packages, 'rgl' package combined with 'car' and 'mgcv' produce interactive graph with a relatively simple code. The below is an example of a 3 dimensional graph drawn using these packages.

library(MASS) library(nnet) library(car) library(rgl) library(mgcv) scatter3d(iris[,1],iris[,2],iris[,3],

In the graphic device, you can use your mouse to move the plotted object and zoom-in/out as you like. The below is a screen shot of the 3-D graph produced by the above code.

3D ๊ทธ๋ž˜ํ”„

No comments:

Post a Comment