require(rms) require(plotly) set.seed(1) # so can reproduce x1 <- runif(100) x2 <- runif(100) x3 <- sample(c('a','b'), 100, TRUE) x4 <- sample(c('k','l','m'), 100, TRUE) y <- runif(100) dd <- datadist(x1, x2, x3, x4); options(datadist='dd') f <- ols(y ~ x1 + x2 + x3 + x4)
ggplotly
on ggplot.Predict
objectThis method works fine.
options(grType=NULL) g <- ggplot(Predict(f,x1)) ggplotly(g)
z <- 900 g <- ggplot(Predict(f,x1)) ggplotly(g, height=z, width=z)
This
ggplot(Predict(f,x1))
That
plotly_build
on ggplot.Predict
objectYou see that when a plot is large, it covers the next output area.
b <- function(g, h=NULL, w=NULL) { a <- plotly_build(g) if(length(h)) { a$layout$height <- h a$layout$width <- w } a } g <- ggplot(Predict(f,x1)) b(g)
z <- 900 g <- ggplot(Predict(f,x1)) b(g, h=z, w=z)
This
ggplot(Predict(f,x1))
That
ggplotly
within ggplot.Predict
This worked fine.
options(grType='plotly') ggplot(Predict(f,x1))
z <- 1200 ggplot(Predict(f,x1), height=z, width=z)
This
ggplot(Predict(f,x1))
That
1200 at 72 dpi is 16.67 inches. Tex and histogram were cut off if figure size was omitted from chunk header.
ggplot(Predict(f), sepdiscrete='vertical', height=z, width=z)
And here is ...
More stuff ....
hist(rnorm(1000))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.