Use R to draw interactive 3D images

Source: Internet
Author: User
1. Install the RGL package, EVD package, and mass package:

> Install. packages ("RGL") Installing package (s) into 'd:/Program/R/Library (as 'lib' is unspecified) Try to open URL 'HTTP: // encoding type 'application/zip' length 1937097 bytes (1.8 MB) enabled urldownloaded 1.8 mbpackage 'rgl 'successfully unpacked and MD5 sums checkedthe downloaded Binary packages are in C: \ Users \ liqiang \ appdata \ Local \ temp \ rtmpijwxp2 \ downloaded_packages> install. packages ("EVD") Installing package (s) into 'd:/Program/R/Library (as 'lib' is unspecified) Try to open URL 'HTTP: // specify type 'application/zip' length 1176009 bytes (1.1 MB) Enable urldownloaded 1.1 mbpackage 'evd' successfully unpacked and MD5 sums checkedthe downloaded Binary packages are in C: \ Users \ liqiang \ appdata \ Local \ temp \ rtmpijwxp2 \ downloaded_packages> install. packages ("mass") Installing package (s) into 'd:/Program/R/Library (as 'lib' is unspecified) Try to open URL 'HTTP: // encoding type 'application/zip' length 872270 bytes (851 KB) enabled urldownloaded 851 kbpackage 'mass' successfully unpacked and MD5 sums checkedthe downloaded Binary packages are in C: \ Users \ liqiang \ appdata \ Local \ temp \ rtmpijwxp2 \ downloaded_packages

2. Input Program
library(rgl)library(MASS)library(evd);data(lossalae)U=rand(lossalae[,1]+rnorm(nrow(lossalae),mean=0,sd=.001))/(nrow(lossalae)+1)V=rank(lossalae[,2])/(nrow(lossalae)+1)M=kde2d(qnorm(U), qnorm(V), n=35)persp3d(M$x, M$y, M$z, col='green',xlab="loss", ylab="alae", zlab="")

3. Output 3D images





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.