Support Questions
Find answers, ask questions, and share your expertise

Getting null device message while displaying ggplots in Zeppelin 0.6.0

Super Collaborator

Hi guys,

I am trying to display ggplots from Zeppelin Livy SparkR interpreter. I get something like ggplot-nullmessage.png. I also tried using ggsave to save the plots to the disk and it is working fine,

ggplot(delay_r, aes(x=STATUS,y=Percentage,fill=STATUS)) + geom_bar(stat="identity") + geom_text(aes(label=STATUS), size = 7) + ylim(0,100)
ggsave(file="/tmp/plot.png")

Can someone please guide me to display this plot in Zeppelin only?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Getting null device message while displaying ggplots in Zeppelin 0.6.0

Super Guru

Make sure R and it's libraries are installed: https://zeppelin.apache.org/docs/0.6.0/interpreter/r.html

stop zeppelin!

yum install R R-devel libcurl-devel openssl-devel

+ devtools with `R -e "install.packages('devtools', repos = 'http://cran.us.r-project.org')"`
+ knitr with `R -e "install.packages('knitr', repos = 'http://cran.us.r-project.org')"`
+ ggplot2 with `R -e "install.packages('ggplot2', repos = 'http://cran.us.r-project.org')"`
+ Other vizualisation librairies: `R -e "install.packages(c('devtools','mplot', 'googleVis'), repos = 'http://cran.us.r-project.org'); require(devtools); install_github('ramnathv/rCharts')"`

then restart zeppelin

test R scripts from the command line

View solution in original post

3 REPLIES 3

Re: Getting null device message while displaying ggplots in Zeppelin 0.6.0

Super Collaborator

Please help guys, I am kind of stuck here.

Re: Getting null device message while displaying ggplots in Zeppelin 0.6.0

Super Guru

Make sure R and it's libraries are installed: https://zeppelin.apache.org/docs/0.6.0/interpreter/r.html

stop zeppelin!

yum install R R-devel libcurl-devel openssl-devel

+ devtools with `R -e "install.packages('devtools', repos = 'http://cran.us.r-project.org')"`
+ knitr with `R -e "install.packages('knitr', repos = 'http://cran.us.r-project.org')"`
+ ggplot2 with `R -e "install.packages('ggplot2', repos = 'http://cran.us.r-project.org')"`
+ Other vizualisation librairies: `R -e "install.packages(c('devtools','mplot', 'googleVis'), repos = 'http://cran.us.r-project.org'); require(devtools); install_github('ramnathv/rCharts')"`

then restart zeppelin

test R scripts from the command line

View solution in original post

Re: Getting null device message while displaying ggplots in Zeppelin 0.6.0

Super Guru

https://support.rstudio.com/hc/en-us/articles/200488548-Problem-with-Plots-or-Graphics-Device

post your notebook

also make sure you are doing your code in a

%spark.r

hist(ed) is the format

Almost all issues with the R interpreter turned out to be caused by an incorrectly set SPARK_HOME. The R interpreter must load a version of the SparkR package that matches the running version of Spark, and it does this by searching SPARK_HOME. If Zeppelin isn't configured to interface with Spark in SPARK_HOME, the R interpreter will not be able to connect to Spark.

see: https://github.com/datalayer/zeppelin-datalayer/issues/2

Try to run this notebook

https://github.com/apache/zeppelin/blob/de4049725d2d9565f04a981c34c3dbe18e0ecd35/notebook/2BWJFTXKJ/...