2016-05-09 2 views
2

Ich versuche, das Scatterplot3d-Paket von R in einem Beaker Notebook zu rendern, aber es kann nicht funktionieren. Ich kann den Code ohne Fehler ausführen, aber die Grafik wird nicht angezeigt. Einstellen der scatterplot3d Ausgabe in eine Variable und Drucken der Variablen bekommt:R-Scatterplot3d Rendering in Beaker Notebook

Eingang:

data(iris) 
test <- scatterplot3d(iris[,1:3]) 
test 

Ausgang:

$xyz.convert 
function (x, y = NULL, z = NULL) 
{ 
xyz <- xyz.coords(x, y, z) 
if (angle > 2) { 
    temp <- xyz$x 
    xyz$x <- xyz$y 
    xyz$y <- temp 
} 
y <- (xyz$y - y.add)/y.scal 
return(list(x = xyz$x/x.scal + yx.f * y, y = xyz$z/z.scal + 
    yz.f * y)) 
} 
<environment: 0x00000000048f8830> 

$points3d 
function (x, y = NULL, z = NULL, type = "p", ...) 
{ 
xyz <- xyz.coords(x, y, z) 
if (angle > 2) { 
    temp <- xyz$x 
    xyz$x <- xyz$y 
    xyz$y <- temp 
} 
y2 <- (xyz$y - y.add)/y.scal 
x <- xyz$x/x.scal + yx.f * y2 
y <- xyz$z/z.scal + yz.f * y2 
mem.par <- par(mar = mar, usr = usr) 
on.exit(par(mem.par)) 
if (type == "h") { 
    y2 <- z.min + yz.f * y2 
    segments(x, y, x, y2, ...) 
    points(x, y, type = "p", ...) 
} 
else points(x, y, type = type, ...) 
} 
<environment: 0x00000000048f8830> 

$plane3d 
function (Intercept, x.coef = NULL, y.coef = NULL, lty = "dashed", 
lty.box = NULL, ...) 
{ 
if (!is.atomic(Intercept) && !is.null(coef(Intercept))) 
    Intercept <- coef(Intercept) 
if (is.null(lty.box)) 
    lty.box <- lty 
if (is.null(x.coef) && length(Intercept) == 3) { 
    x.coef <- Intercept[if (angle > 2) 
     3 
    else 2] 
    y.coef <- Intercept[if (angle > 2) 
     2 
    else 3] 
    Intercept <- Intercept[1] 
} 
mem.par <- par(mar = mar, usr = usr) 
on.exit(par(mem.par)) 
x <- x.min:x.max 
ltya <- c(lty.box, rep(lty, length(x) - 2), lty.box) 
x.coef <- x.coef * x.scal 
z1 <- (Intercept + x * x.coef + y.add * y.coef)/z.scal 
z2 <- (Intercept + x * x.coef + (y.max * y.scal + y.add) * 
    y.coef)/z.scal 
segments(x, z1, x + y.max * yx.f, z2 + yz.f * y.max, lty = ltya, 
    ...) 
y <- 0:y.max 
ltya <- c(lty.box, rep(lty, length(y) - 2), lty.box) 
y.coef <- (y * y.scal + y.add) * y.coef 
z1 <- (Intercept + x.min * x.coef + y.coef)/z.scal 
z2 <- (Intercept + x.max * x.coef + y.coef)/z.scal 
segments(x.min + y * yx.f, z1 + y * yz.f, x.max + y * yx.f, 
    z2 + y * yz.f, lty = ltya, ...) 
} 
<environment: 0x00000000048f8830> 

$box3d 
function (...) 
{ 
mem.par <- par(mar = mar, usr = usr) 
on.exit(par(mem.par)) 
lines(c(x.min, x.max), c(z.max, z.max), ...) 
lines(c(0, y.max * yx.f) + x.max, c(0, y.max * yz.f) + z.max, 
    ...) 
lines(c(0, y.max * yx.f) + x.min, c(0, y.max * yz.f) + z.max, 
    ...) 
lines(c(x.max, x.max), c(z.min, z.max), ...) 
lines(c(x.min, x.min), c(z.min, z.max), ...) 
lines(c(x.min, x.max), c(z.min, z.min), ...) 
} 
<environment: 0x00000000048f8830> 

Ich bin mir nicht sicher, ob diese Funktionalität mit Beaker Notebooks möglich ist, aber Ich dachte, ich überprüfe hier, ob jemand irgendwelche Tipps hat.

Danke,
-pH +

Antwort

1

es herausgefunden. Als Teil meines Code, ändert es das Arbeitsverzeichnis von R mehr zieht leicht in Datendateien von meinem Projektordner über:

setwd("C:/Users/macle/Desktop/UPC Masters/Semester 1/CN/MAI-CN/Final Project") 

Es dass irgendwo auf dem Weg erscheint, das die Fähigkeit der scatterplot3d bricht die angezeigt werden Ausgabe in einem Becher Notebook.

Ich habe stattdessen nur absolute Pfade verwendet, um die Dateien zu laden, die ich brauche, was das Problem für mich gelöst hat.

@spot Danke, dass Sie mich in die richtige Richtung weisen und bestätigen, dass das Problem auf meinem Ende lag und keine Einschränkung von Beaker.

Ps. Ich liebe es, mit Beaker zu arbeiten, danke für die Entwicklung eines fantastischen Tools.

+0

ich danke Ihnen, glücklich, es zu hören. Der Mangel an Kontrolle über CWD ist ein Problem, irgendwo im Issue Tracker, tut mir leid. – spot

Verwandte Themen