![]() ![]() Z.pred <- matrix(predict(fit, newdata = xy), Y.pred <- seq(min(y), max(y), length.out = grid.lines) X.pred <- seq(min(x), max(x), length.out = grid.lines) # Compute the linear regression (z = ax + by + d) Use the argument surf in scatter3D() function to add a regression surface.Use the function lm() to compute a linear regression model: ax + by + cz + d = 0.The mtcars data will be used: data(mtcars) This is described at the end of the present article. ![]() The package plot3Drgl allows to plot easily the graph generated with plot3D in openGL, as made available by package rgl. This “4D” plot (x, y, z, color) with a color legend is not (easily) possible using the packages mentioned above (scatterplot3d, scatter3d, rgl). In addition to the x, y (and z) values, an additional data dimension can be represented by a color variable (argument colvar). Plot3D, from Karline Soetaert, is an R package containing many functions for 2D and 3D plotting: scatter3D, points3D, lines3D, text3D, ribbon3d, hist3D, etc. ![]() To close the discussion about 3D, in this tutorial I’ll describe the impressive plot3D package and its extension plot3Drgl package. In my previous articles, I already described how to make 3D graphs in R using the package below:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |