rgl

Including a 3D interactive figure in html and static in word/pdf using knitr and rgl

限于喜欢 提交于 2019-12-30 00:46:07
问题 Following this question (including a interactive 3D figure with knitr) and this example by Yihui (https://dl.dropboxusercontent.com/u/15335397/misc/webgl-rmd.html), I can include a 3D interactive figure in html output using knitr and Rmarkdown. But I would like to include a static figure in word/pdf output. Is it possible to do this? Thanks for any suggestion. My sessionInfo > sessionInfo() R version 3.1.1 (2014-07-10) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English

3D equivalent of the curve function in R?

旧街凉风 提交于 2019-12-28 06:47:11
问题 The curve function in R provides a simple way to plot a function. For example, this will plot a straight line f1 <- function(x) x curve(f1, from=-1, to=1) Is there an equivalent function in R which takes a function with two argument (e.g., x and y ) and ranges for both variables and produces a 3D plot? For example, imagine I had the following function f2 <- function(x, y) x + y Is there a command similar to the following? curve_3d(f2, x_range=c(-1, 1), y_range=c(-1, 1)) 回答1: The surface3d

rgl: low resolution legend

你说的曾经没有我的故事 提交于 2019-12-25 00:27:32
问题 Hi guys, I'm using rgl and shinyrgl to produce a 3D PCA plot within my Shiny app. I'm then using the legend3d function to create the legend. As you can see from the image above, the legend is significantly lower resolution than the plot. Has anyone else experienced this problem? I've included the code being used to draw this below. Since it's Shiny it is a little difficult to produce a full working example. I'm more looking to see if anyone else has fixed this problem. Matt UI tabItem(tabName

Plot Sphere with custom gridlines in R

浪子不回头ぞ 提交于 2019-12-25 00:08:49
问题 I would like to plot a sphere in R with the gridlines on the surface corresponding to the equal area gridding of the sphere using the arcos transformation. I have been experimenting with the R packakge rgl and got some help from : Plot points on a sphere in R Which plots the gridlines with equal lat long spacing. I have the below function which returns a data frame of points that are the cross over points of the grid lines I want, but not sure how to proceed. plot_sphere <- function(theta_num

How can I recreate this 3d histogram?

若如初见. 提交于 2019-12-24 15:04:00
问题 I am talking about this picture: Questions: This is R, not Matlab right? Below the page it says it was made with R.... How can I do this? I mean, how can I create such a 3d scatterplot with this advanced green surface and this grid? I now how to make simple scatterplots and also 3d scatterplots, but how can I create such an advanced picture? Which package is this? I want to include it in a paper where this picture should rotate automatically. I know how to include this into my tex

R binning dataset and surface plot

与世无争的帅哥 提交于 2019-12-24 13:52:33
问题 I have a large data set that I am trying to discretise and create a 3d surface plot with: rowColFoVCell wpbCount Feret 1 001001001001 1 0.58 2 001001001001 1 1.30 3 001001001001 1 0.58 4 001001001001 1 0.23 5 001001001001 2 0.23 6 001001001001 2 0.58 There are currently 695302 rows in this data set. I am trying to discretise the third 'Feret' column based on the second column, so for each 'wpbCount' bin the 'Feret' column. I think the solution will involve using cut but I am not sure how to

3D Plot of normal distribution in R around a (x,y) point

和自甴很熟 提交于 2019-12-24 12:16:52
问题 I want to plot a univariate normal density function of the normal distribution onto a (x,y,z) coordinate system. The code I am using is: library(rgl) open3d() x <- seq(0, 10, length=100) y <- seq(0, 10, length=100) z = outer(x,y, function(x,y) dnorm(x,2.5,1)*dnorm(y,2.5,1)) persp3d(x, y, z,col = rainbow(100)) The problem I an encountering is that I want the normal distribution not to be around its mean only but also to be on a straight line or a circle. In latter case, I would expect the

How to plot a surface in rgl plot3d

偶尔善良 提交于 2019-12-24 07:15:32
问题 So I have this code that produces the exact surface f = function(x, y){ z = ((x^2)+(3*y^2))*exp(-(x^2)-(y^2)) } plot3d(f, col = colorRampPalette(c("blue", "white")), xlab = "X", ylab = "Y", zlab = "Z", xlim = c(-3, 3), ylim = c(-3, 3), aspect = c(1, 1, 0.5)) Giving the following plot: Now I have some code that does a random walk metropolis algorithm to reproduce the above image. I think it works as if I do another plot of these calculated values I get the next image with 500 points. Here is

Why do vertex normals flip after rotating 3D point cloulds?

蹲街弑〆低调 提交于 2019-12-24 05:17:11
问题 I have two samples of 3D point cloud of human face. The blue point cloud denote target face and the red point cloud indicates the template. The image below shows that the target and template face are aligned in different directions (target face roughly along x-axis, template face roughly along y-axis). Figure 1: The region around the nose is displayed in Figure 1. I want to rotate my target face (blue face) with nasal tip as the center of rotation (I translated the target to the template

Doesn't work legend3d function in the newest version of the rgl package

怎甘沉沦 提交于 2019-12-24 01:08:09
问题 I've installed the newest version of the rgl package by means of advice from the link below: How do I install the latest version of rgl? Then i tried to reproduce the code example of the answer from the post: Adding a legend to an rgl 3d plot Everything is working Ok except the command: legend3d("topright", legend = paste('Type', c('A', 'B', 'C')), pch = 16, col = rainbow(3), cex=1, inset=c(0.02)) After executing the above command i have the warning message and no legend on the 3dplot in fact