rgl

plot3d() - How to change z axis surface color to heat map color

馋奶兔 提交于 2020-01-06 02:47:08
问题 In the above image the surface colored in z axis (like heat map). I am using plot3d() plot3d(data$x, data$y, data$z, name = 'Plotly3D graph', type = 'l', axes=F) I have to repeat the same color as of in the image. By using above code I can get the 3D square but I dont know where to set the color of z axis as same as the image. Please help me in plot3D. If full code is needed will post if required. Here is sample code: data1 <- read.csv(file.choose(),1) # retrieve age column from csv file var1

Smooth 3D trangular mesh in R

心已入冬 提交于 2020-01-05 16:29:51
问题 I am drawing a 3D surface mesh of human face. Data can be found at https://github.com/Patricklv/Smoothing-3D-surface, where vb.xlsx contains vertices and it.xlsx contains faces. My R code is as follows: library(xlsx) library(rgl) vb <- read.xlsx("C:\\Users\\<Username>\\Desktop\\vb.xlsx", sheetIndex = 1, header = F) it <- read.xlsx("C:\\Users\\<Username>\\Desktop\\it.xlsx", sheetIndex = 1, header = F) vb_mat <- t(as.matrix(vb)) vb_mat <- rbind(vb_mat, 1) rownames(vb_mat) <- c("xpts", "ypts",

Smooth 3D trangular mesh in R

大憨熊 提交于 2020-01-05 16:29:27
问题 I am drawing a 3D surface mesh of human face. Data can be found at https://github.com/Patricklv/Smoothing-3D-surface, where vb.xlsx contains vertices and it.xlsx contains faces. My R code is as follows: library(xlsx) library(rgl) vb <- read.xlsx("C:\\Users\\<Username>\\Desktop\\vb.xlsx", sheetIndex = 1, header = F) it <- read.xlsx("C:\\Users\\<Username>\\Desktop\\it.xlsx", sheetIndex = 1, header = F) vb_mat <- t(as.matrix(vb)) vb_mat <- rbind(vb_mat, 1) rownames(vb_mat) <- c("xpts", "ypts",

Fill area between two segments in a 3D plot {rgl}

做~自己de王妃 提交于 2020-01-05 08:01:26
问题 I have made a tetrahedron using vertex coordinates and line segments using the function plot3d() from the package {rgl}. The code below makes the mentioned plot library("rgl") CCl4=c(5,5,5,10) Luminol=c(0.01,0.001,0.005,0.005) Na2CO3=c(0.01,0.01,0.1,0.05) plot3d( Luminol, Na2CO3, CCl4, type = "s") for(i in 1:4){ for(k in 1:4){ segments3d(x=Luminol[c(i,k)],y=Na2CO3[c(i,k)],z=CCl4[c(i,k)]) } } Now, I want to fill the area between the points (preferably using a RGB color so I can define

RGL in R Shiny not rotating on left mouse button click

久未见 提交于 2020-01-05 05:24:07
问题 Just a short moment ago my question on how to embed an rgl in shiny was answered by Mike, but we seem to have stumbled into another issue, This is the code example: library(rgl) library(car) library(shiny) cars$time <- cars$dist/cars$speed ui <- fluidPage( hr("how do we get the plot inside this app window rather than in a popup?"), rglwidgetOutput("plot", width = 800, height = 600) ) server <- (function(input, output) { output$plot <- renderRglwidget ({ rgl.open(useNULL=F) scatter3d(x=cars

How to move axis labels automatically in rgl R

那年仲夏 提交于 2020-01-04 07:50:08
问题 Thanks firstly, to anyone taking time to read my poor English and help me solve my problem (this is my first question post). In rgl, axes that bbox-function writes move automatically so that they do not obscure the data. But axis labels don't move. As far as I know, title3d() and mtext3d() can only write axis labels at fixed positions. I realize it forcibly by changing axis tick labs into axis labs. But the graph is messy and the method can't treat a long lab. Is there a way to make

How do I install the R package rgl on Ubuntu 9.10? [duplicate]

左心房为你撑大大i 提交于 2020-01-01 13:37:25
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Problem Installing rgl I'm trying to install the R package rgl on Ubuntu 9.10. I'm using R version 2.12.1. I got the following error: "configure: error: missing required header GL/gl.h" I asked this question earlier without the restriction that I use Ubuntu 9.10, and the answer I got was to update R, but I haven't been able to do this, possibly because Ubuntu 9.10 is not supported by the folks at CRAN. 回答1: Just

R - Plot a region described by planes with rgl

不羁岁月 提交于 2020-01-01 02:35:06
问题 I want to plot a polyhedron, which is described by the following inequalities: 3*x+5*y+9*z<=500 4*x+5*z<=350 2*y+3*z<=150 x,y,z>=0 It is a linear program. The objective function is: 4*x+3*y+6*z The polyhedron is the feasible region for this program. I am able to plot the inequalities as planes, which should describe the polyhedron (Note that this is my first try with rgl, so the code is kinda messy. if you want to improve it, please feel free to do so): # setup x <- seq(0,9,length=20)*seq(0,9

3d scatterplot with colored spheres with R and Rgl

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-31 17:37:50
问题 I want to create a 3d scatter plot of spheres with their color being the fourth dimension. I have the data in a csv file where each line indicates the x,y,z position of a particle and I have a column which tells me the value of the particle (1,2 or 3). I want to color the balls in one color if their value is 1 or in another color otherwise. Edit: I created the following code: library(rgl) m <- read.csv(file="mem0.csv", sep = ",", head=TRUE) mcol = m$val i = 1 mdim = dim(m) while (i <= mdim[1]

5 dimensional plot in r

自古美人都是妖i 提交于 2019-12-31 08:53:15
问题 I am trying to plot a 5 dimensional plot in R. I am currently using the rgl package to plot my data in 4 dimensions, using 3 variables as the x,y,z, coordinates, another variable as the color. I am wondering if I can add a fifth variable using this package, like for example the size or the shape of the points in the space. Here's an example of my data, and my current code: set.seed(1) df <- data.frame(replicate(4,sample(1:200,1000,rep=TRUE))) addme <- data.frame(replicate(1,sample(0:1,1000