[R] ggplot2 not displaying graph in RH7 RStudio Server 3.2.3

phiroc at free.fr phiroc at free.fr
Wed May 18 14:57:11 CEST 2016



Here's a minimal example that displays a bar chart in RStudio 3.2.4 for Windows, but not in RStudio Server 3.2.3 on RH Linux 7:

------------------------------------------------------------------- R Code -------------------------------------------------------------------

library(ggplot2)
a <- c("ab", "bc", "cd")
b <- c("de", "fg", "hi")
ds <- data.frame(a,b)
g1 <- ggplot(data = ds, aes(x=a))
g1 + geom_bar(stat="count", fill=rainbow(3), colour="black") + xlab("Action & Description") + ylab("Count")  +  ggtitle("test") + coord_flip()

----------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------- sessionInfo on Windows ----------------------------------------------------------

R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gridExtra_2.2.1 ggthemes_3.0.2  lubridate_1.5.0 RJDBC_0.2-5     rJava_0.9-8    
[6] DBI_0.3.1       ggplot2_2.1.0  

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.4        assertthat_0.1     grid_3.2.4         plyr_1.8.3        
 [5] gtable_0.2.0       magrittr_1.5       scales_0.4.0       stringi_1.0-1     
 [9] labeling_0.3       tools_3.2.4        stringr_1.0.0      munsell_0.4.3     
[13] rsconnect_0.4.1.11 colorspace_1.2-6  
> 

--------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------- sessionInfo on RH Linux 7 -------------------------------------------------------

R version 3.2.3 (2015-12-10)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8  
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gridExtra_2.2.1 ggthemes_3.0.3  ggplot2_2.1.0   lubridate_1.5.6 RJDBC_0.2-5     rJava_0.9-8     DBI_0.4-1      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.5      assertthat_0.1   grid_3.2.3       plyr_1.8.3       gtable_0.2.0     magrittr_1.5     scales_0.4.0     stringi_1.0-1   
 [9] tools_3.2.3      stringr_1.0.0    munsell_0.4.3    colorspace_1.2-6

------------------------------------------------------------------------------------------------------------------------------------------





----- Mail original -----
De: "Jeff Newmiller" <jdnewmil at dcn.davis.ca.us>
À: phiroc at free.fr, r-help at r-project.org
Envoyé: Mercredi 18 Mai 2016 14:36:50
Objet: Re: [R] ggplot2 not displaying graph in RH7 RStudio Server 3.2.3

Context is everything. Please follow the Posting Guide and provide a minimal reproducible example. Also, if your scripts are literally the same on the two platforms, you should provide the output of the sessionInfo() function for each. 
-- 
Sent from my phone. Please excuse my brevity. 


On May 18, 2016 12:32:47 AM PDT, phiroc at free.fr wrote: 


Hello, 

I have written an R script which displays a bar chart using the ggplot2 library (please refer 
to code excerpt at the bottom of this e-mail). 

Although the bar chart is displayed OK in the Windows version of RStudio (v. 3.2.4), 
nothing appears on Linux RH 7 in Rstudio Server 3.2.3. 

I have tried replacing the data frame in the RH-version of the script by 




a <- c("ab", "bc", "cd") 
b <- c(1, 2, 3) 
ds <- data.frame(a,b) 
g1 <- ggplot(data = ds, aes(x = a)) 





... but to avail: ggplot doesn't plot anything. No error message are displayed. 

Any help with this issue would be much appreciated. 

Many thanks. 

phiroc 


----------------------------- R Code Excerpt 



g1 <- ggplot(data = mergedD, aes(x=DESC_TYPE)) 
g1 + geom_bar(stat="count",
fill=rainbow(numberOfDistinctActions), colour="black") + 
xlab("Action & Description") + 
ylab("Count")  + 
ggtitle(paste0( 
"Number of Customer Actions in XXX from ", day0, "/", mon, 
"/", year, " to ", day1, "/", mon, "/", year, 
" in Paris & Hong Kong")) + 
coord_flip() 



R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/r-help 
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
and provide commented, minimal, self-contained, reproducible code. 



More information about the R-help mailing list