Description
I'm generating plotly
figures in R
on my institution's computing cluster and I'd like to be able to view them on my personal mac (e.g., saving a PDF
or SVG
static image doesn't work well on the cluster - too many installations involved to get plotly::orca
to work).
I thought that saving the plotly
object to an RDS
format file, e.g.:
library(plotly)
p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length,
marker = list(size = 10,
color = 'rgba(255, 182, 193, .9)',
line = list(color = 'rgba(152, 0, 0, .8)',
width = 2))) %>%
layout(title = 'Styled Scatter',
yaxis = list(zeroline = FALSE),
xaxis = list(zeroline = FALSE))
saveRDS(r,"p.RDS")
And then reading it in RStudio
on my mac shouldn't be a problem. However, when trying to run:
readRDS("p.RDS")
on my mac's RStudio
, I get this error:
Error in dirname(to) : a character vector argument expected
Reading it into a variable:
p <- readRDS("p.RDS")
does not cause an error so the object is read in successfully but cannot be displayed.
I see that p$dependencies
shows the path to where plotly/htmlwidgets/lib/typedarray
is installed on the cluster. Could that be the issue? If so is there anyway to avoid that or change it?
Alternatively, is it possible to simply recreate a plotly
figure from p$x
?