Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No text while plotting in R notebook #7455

Closed
DivM opened this issue Nov 23, 2017 · 14 comments
Closed

No text while plotting in R notebook #7455

DivM opened this issue Nov 23, 2017 · 14 comments

Comments

@DivM
Copy link

DivM commented Nov 23, 2017

While plotting any plot in R on Jupyter notebook, all text in the plot (title, axes label etc.) is not being printed. This problem is there with both ggplot and normal plot function. Here's an example of the same:

edbfadc

This issue is limited to R notebooks as Python notebooks are plotting properly. The locale for R is as follows:

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

Refer to this for Stackoverflow question.

@mingwandroid
Copy link

mingwandroid commented Nov 23, 2017

Instead of putting links to external sites, you should copy the contents here, like this:

Here's the sessionInfo()

R version 3.4.2 (2017-09-28)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: Amazon Linux Bare Metal release 2012.03

Matrix products: default
BLAS: /home/dmangla/sof/anaconda3/lib/R/lib/libRblas.so
LAPACK: /home/dmangla/sof/anaconda3/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] 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] dplyr_0.7.4     purrr_0.2.3     readr_1.1.1     tidyr_0.7.1    
[5] tibble_1.3.4    ggplot2_2.2.1   tidyverse_1.1.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.13     cellranger_1.1.0 compiler_3.4.2   plyr_1.8.4      
 [5] bindr_0.1        forcats_0.2.0    tools_3.4.2      digest_0.6.12   
 [9] uuid_0.1-2       lubridate_1.6.0  gtable_0.2.0     jsonlite_1.5    
[13] evaluate_0.10.1  nlme_3.1-131     lattice_0.20-35  pkgconfig_2.0.1 
[17] rlang_0.1.2      psych_1.7.8      IRdisplay_0.4.4  IRkernel_0.8.9  
[21] parallel_3.4.2   haven_1.1.0      bindrcpp_0.2     xml2_1.1.1      
[25] httr_1.3.1       repr_0.12.0      stringr_1.2.0    hms_0.3         
[29] grid_3.4.2       glue_1.1.1       R6_2.2.2         readxl_1.0.0    
[33] foreign_0.8-69   pbdZMQ_0.2-6     modelr_0.1.1     reshape2_1.4.2  
[37] magrittr_1.5     scales_0.5.0     rvest_0.3.2      assertthat_0.2.0
[41] mnormt_1.5-5     colorspace_1.3-2 labeling_0.3     stringi_1.1.5   
[45] lazyeval_0.2.0   munsell_0.4.3    broom_0.4.2      crayon_1.3.4    

I've tried reinstalling the packages but the problem still persists. Kindly tell if anyone knows what's the problem here and how to fix it.

Thanks to all.

@mingwandroid
Copy link

AFAICT you need to install some fonts on your Linux distro here. Boxes is what you get when fonts are missing.

Run X11Fonts() from within R and show the output.

@DivM
Copy link
Author

DivM commented Nov 23, 2017

This is the output:

$serif
'-*-times-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$sans
'-*-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$mono
'-*-courier-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$Times
'-adobe-times-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$Helvetica
'-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$CyrTimes
'-cronyx-times-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$CyrHelvetica
'-cronyx-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$Arial
'-monotype-arial-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$Mincho
'-*-mincho-%s-%s-*-*-%d-*-*-*-*-*-*-*'

@mingwandroid
Copy link

You need to install some of those fonts. This is not an Anaconda problem.

@DivM
Copy link
Author

DivM commented Nov 23, 2017

Can you show the correct/expected output of the above?

Thanks for the help.

@mingwandroid
Copy link

That is the correct output. I wanted you to see the name of the fonts you need to install. I don't know anything about the Amazon Linux Bare Metal release 2012.03 distribution though so I do not know how you would install those fonts on that.

@shenweiyan
Copy link

shenweiyan commented Apr 11, 2018

This is because the fonts are missing in anaconda, what we need is to install it:

conda install -c anaconda fonts-anaconda

@mingwandroid
Copy link

Those fonts are for qt-based apps on Linux only at present (and I added them explicitly in support of RStudio). To the best of my knowledge you need system fonts here.

@BhaskarCoursera
Copy link

DivM, were you able to fix this issue?

@rtmag
Copy link

rtmag commented Mar 2, 2020

For those of you still looking for the fix, as suggested by @shenweiyan conda install -c anaconda fonts-anaconda worked for me, thanks!

@multimeric
Copy link

I'm on Linux, and conda install -c anaconda fonts-anaconda didn't help me.

My X11Fonts() returns this (not really sure what it means, though):

$serif
'-*-times-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$sans
'-*-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$mono
'-*-courier-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$Times
'-adobe-times-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$Helvetica
'-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$CyrTimes
'-cronyx-times-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$CyrHelvetica
'-cronyx-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$Arial
'-monotype-arial-%s-%s-*-*-%d-*-*-*-*-*-*-*'
$Mincho
'-*-mincho-%s-%s-*-*-%d-*-*-*-*-*-*-*'

And I get plots looking like this:
image

If I need to install fonts onto my system, what should they be?

@MadBugs
Copy link

MadBugs commented Sep 19, 2020

I am on Ubuntu 18.04

This solved to me:
conda install -c r r-cairo

This also fixes the prob:
#It can be 'cairo', 'cairo-fonts', 'Xlib'. 'quartz'
options(bitmapType="quartz")

So it is for sure a problem of fonts missing... I used Anaconda to create the R environment. It seems that they left some critical packages behind when the env was created.

@multimeric
Copy link

Oh, thank you so much, conda install -c r r-cairo is what fixed it for me, none of the other packages helped.

@ghost
Copy link

ghost commented Jul 26, 2021

I also faced same problem. Thanks @MadBugs for your comment. conda install -c r r-cairo worked for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants