Menu
  • HOME
  • TAGS

knitr and rgl: inconsistent size?

r,knitr,rmarkdown,rgl

I've found the explanation for the difference. When pandoc is present, knitr reports to the chunk hook that options$dpi is 192. When it is not present, the chunk hook is told options$dpi is 72. The workaround I'll adopt is to ignore options$dpi, and fix dpi at 96 in my rgl...

Adding a legend to an rgl 3d plot

r,plot,3d,rgl

I'm not sure the colkey option applies to the plot3d function. You can use legend3d instead to add a legend the way you would in normal 2d plots: library(rgl) #dummy data set.seed(1) x <- cumsum(rnorm(100)) y <- cumsum(rnorm(100)) z <- cumsum(rnorm(100)) cuts = cut(x = 1:length(x), breaks = 3) #...

5 dimensional plot in r

r,plot,rgl,multi-dimensional-scaling

Here is a ggplot2 option. I usually shy away from 3D plots as they are hard to interpret properly. I also almost never put in 5 continuous variables in the same plot as I have here... ggplot(df, aes(x=var1, y=var2, fill=var3, color=var4, size=var5^2)) + geom_point(shape=21) + scale_color_gradient(low="red", high="green") + scale_size_continuous(range=c(1,12)) While...

rgl 2D surface plot of matrix not enough detail

r,rgl

Something like this? library(rgl) library(colorRamps) # for matlab.like(...) palette <- matlab.like(10) # palette of 10 colors rlim <- range(r[!is.na(r)]) colors <- palette[9*(r-rlim[1])/diff(rlim) + 1] open3d(scale=c(1/6,1/6,1/diff(range(r)))) surface3d(1:6 , 1:6 , r, color=colors, back="lines") Part of your problem is that you were using rgl.surface(...) incorrectly. The second argument is the matrix of...

RGL package for R compile error

r,rgl

The issue is with freetype2 2.6. Downgrading to freetype2 2.5 allows rgl to compile properly. For archlinux you can just run pacman -U /var/cache/pacman/pkg/freetype2-2.5.5-1-x86_64.pkg.tar.xz to downgrade to the older package....

Complete missing lines using rgl grid3d

r,graphics,3d,rgl

I would say it is a bug. You don't get any z-lines when using grid3d("y",n=2) even though it should be the same. You can work around it by using the list specification of at, setting the x element of the list, eg: grid3d("y", at = list(x=pretty(spts, n = 2))) ...

Sorting vertex and adding colors to groups in igraph r

r,sorting,igraph,rgl

First, it would be nicer if you had your name/class assignments in a data.frame. (It also would have been nice if they were stored in a list or something). Here I gather all the ClassA/B/C/* varaibles into a list and stack them indclass <- stack(mget(ls(pattern="Class*"))) indclass # values ind #...

Using “expression” in R rgl axis labels

r,graphics,3d,rgl

On my system (OSX 10.7.5, R 3.1.2) I get an alpha as xlab with: require(rgl) plot3d(1,1,1,xlab=intToUtf8(0x03B1L) ) And pasting to ordinary text also succeeds: plot3d(1,1,1, xlab=paste("Lyman ", intToUtf8(0x03B1L) ) ) ...

Add 2D conditional distributions (in a third dimension) to 2D scatterplot in R

r,graphics,3d,ggplot2,rgl

Maybe this will help. (I've never been very happy with he ggplot paradigm so I'm showing a base graphics version that someone can translate.) I also thought adding the group means to the df-object confused things so I'm only using the oritignal df. aggregate(y~x,df, FUN=function(y) c(mn=mean(y),sd=sd(y)) ) #-------- x y.mn...