rgl

How can I change the size of rgl plots in Shiny RMarkdown?

戏子无情 提交于 2019-12-23 21:41:15
问题 I'm creating a Shiny document using RMarkdown and am including reactive plots from rgl . I cannot, however, change the viewport size of the rendered plots. That is, I cannot change the height and width of the space in which the plots render. How might I make the rendered plots bigger than their default? EDIT: Alternating fig.width in the knitr options does not change the width of Shiny render functions, it seems. Below is the document I have so far. --- title: "Untitled" runtime: shiny output

Draw multiple 3D boxes of different dimensions and coordinates in R

∥☆過路亽.° 提交于 2019-12-23 17:15:29
问题 Recently I stumbled over the rgl-Package in R, which can be used to create interactive 3d plots. Now I want to visualize a set of boxes in one 3d plot. A Box B has cartesian coordinates B_coord=[x,y,z], which correspond to the lower left back corner and dimensions B_dim=[x1,y1,z1]. Apparently it is easy to draw, scale and position some cubes with the following exemplary code: open3d() printBox <- function(x,y,z,x1,y1,z1) { mycube <- scale3d(cube3d(),x1,y1,z1) wire3d(translate3d(mycube,x,y,z))

Help in using rgl package

女生的网名这么多〃 提交于 2019-12-23 09:25:56
问题 I installed rgl package with the option --disable-libpng. I tried generating a 3d scatter plot and it crashes. Please help me in resolving this This is the code i am running library(rgl) open3d() x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x,y) plot3d(x, y, z, col=rainbow(1000)) It crashes with below messages *** caught segfault *** address (nil), cause 'memory not mapped' Traceback: 1: .External(rgl_par3d, args) 2: par3d(skip) 3: plot3d.default(x, y, z, col = rainbow

How to plot a plane from an equation in R

对着背影说爱祢 提交于 2019-12-22 12:23:54
问题 I've been tinkering with the RGL package to figure out how to plot a plane from an equation in R, to no avail. For example, I would like to visualize the following plane: 1x + 0y + 0z = 2 0x + 1y + 0z = 3 0x + 0y + 1z = 4 It seems the rgl's planes3d function only adds a plane to an existing 3D plot. 回答1: Here is a simple example: library(rgl) # Create some dummy data dat <- replicate(2, 1:3) # Initialize the scene, no data plotted plot3d(dat, type = 'n', xlim = c(-1, 1), ylim = c(-1, 1), zlim

Cannot change text size in rgl plot

依然范特西╮ 提交于 2019-12-22 08:41:53
问题 I have a problem changing the text size of a 3d plot I generated with the package rgl. Everything works fine, but I can't effectively change the cex properties of an 3d object. I run R 2.14.1 (2011-12-22) under 64bit Ubuntu 10.04 LTS (2.6.32-37-generic). As an example see the following code (I found on Stack Overflow): library(rgl) set.seed(1001) n <- 20 text3d(runif(n),runif(n),runif(n),LETTERS[1:n],cex=seq(0.5,5,length=n)) The letters have all the same size when I plot them. Any help is

Overlay a map on top of a 3d surface map in r

爱⌒轻易说出口 提交于 2019-12-20 08:40:28
问题 I have created a 3d map using rgl.surface(), mainly following Shane's answer in this post. Using my own data, I get this map On top of this surface map, I would like to add a map of vegetation density such that I obtain something like this (obtained with the software Surfer): Is it possible to do this with rgl, or for that matter any other package in r or is the only solution to have two maps like in Shane's answer? Thank you. Edit: Following @gsk3's request, here is the code for this map:

How to plot a regression plane with an interaction in rgl

折月煮酒 提交于 2019-12-20 03:26:06
问题 I want to plot the regression surface from a model with an interaction term using rgl 's interactive plotting system. It is easy to plot a regression plane for a model without an interaction term using: plot3d(x=x1, y=x2, z=y1, type="s", col="yellow", size=1) planes3d(a=coef(mod1)[2], b=coef(mod1)[3], c=-1, d=coef(mod1)[1], alpha=.5) However, when the plane twists, this seems to be more difficult. Following on this question: 3D equivalent of the curve function in r, I am trying: f2 <-

rgl vector diagrams: show right angles for orthogonal vectors

别等时光非礼了梦想. 提交于 2019-12-19 07:49:12
问题 In the matlib package, https://github.com/friendly/matlib/, I have a function, vectors3d() to draw geometric vector diagrams. The following code gives an example figure showing a unit vector "J" and some of its projections on the X, Y, Z axes. In the calls to segments3d , each argument is a 2 x 3 matrix giving start/end coordinates. if (!require(matlib)) devtools::install_github(friendly/matlib) library(matlib) library(rgl) vec <- rbind(diag(3), c(1,1,1)) rownames(vec) <- c("X", "Y", "Z", "J"

How to increase smoothness of spheres3d in rgl

牧云@^-^@ 提交于 2019-12-18 16:33:23
问题 When I use rgl::spheres3d() , the rendered spheres have clunky facetted edges. spheres = data.frame(x = c(1,2,3), y = c(1,3,1), color = c("#992222" , "#222299", "#229922")) open3d() spheres3d(spheres$x, spheres$y, radius = 1, color = spheres$color) Setting material3d(smooth = TRUE, line_antialias = TRUE) does not improve this. Increasing the radius does not help either. Is there any way to increase the smoothness with which they are drawn? 回答1: Expanding on cuttlefish44's excellent answer, I

Adding a legend to an rgl 3d plot

时光怂恿深爱的人放手 提交于 2019-12-18 05:55:55
问题 I am trying to draw a 3d plot using rgl with colors legend indicating which color refer to which class (called 'cut.rank'): plot3d( data.focus$normalized.price_shipping, data.focus$seller_feedback_score_rank, data.focus$seller_positive_feedback_percent_rank, col=as.factor(data.focus$cut.rank), size=1, type='s', xlab = 'Normalized Price', ylab = 'Seller Feedbacl Score Rank', zlab = 'Seller Positive Feedback Percent Rank', main = 'Rank By Price, Feedback score and Positive Feedback Score', sub