I'm trying to make an interactive version of my ggplot2 using the plotly package. It works fine when I do it from a personal computer.
Unfortunately, I'm at work, on a windows machine behind a proxy, and it fails to connect to the plotly server. Browsing the code source, I think the issue might be with the postFrom
function from RCurl
. I tried adding the proxy to options(RCurlOptions = list(proxy="http://proxyurl:8080"))
, but that doesn't seem to improve things. Is there a known workaround?
library(httr)
set_config(use_proxy(url="http://proxy.xxx.fr",port=8080,username="",password=""))
options('RCurlOptions'= c(options('RCurlOptions'), list(proxy = 'http://proxy.xxxx.fr:8080')))
library(plotly)
set_credentials_file(username="baptiste", api_key="xxxx")
require(plotly)
p2 <- qplot(1,1)
py <- plotly(username="baptiste")
out <- py$ggplotly(p2)
# Error in function (type, msg, asError = TRUE) : couldn't connect to host
pub$makecall
in plotly.R overwrites your global RCurlOptions. I've submitted a pull request to fix this.
I think that if you set your RCurl options like this:
opts <- list(
proxy = "myweb.proxy.com",
proxyusername = "myproxyuser",
proxypassword = "myproxypassword",
proxyport = 8080
)
options(RCurlOptions = opts)
Then you should be able to connect to the host, at least this works for me behind my work proxy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With