yixuan / showtext

Using Fonts More Easily in R Graphs
http://cran.r-project.org/web/packages/showtext/index.html
478 stars 38 forks source link

jupyter notebook #19

Open slowkow opened 6 years ago

slowkow commented 6 years ago

Hi Yixuan,

I wonder if you might have an idea why showtext is not working as expected in the Jupyter notebook. Is there any way I can try to debug this?

Here's a notebook showing that showtext is actually working, but not when it is displayed automatically by Jupyter...

In other words, I have to save the figure to a file and then show the file with:

library(imager)
im <- load.image("showtext-ex2.png")
plot(im, axes = FALSE)

https://gist.github.com/slowkow/771238703396bd006f3aeb0943147c85

Is it possible to modify showtext to display by default in a Jupyter notebook?

Do you know any workarounds?

R version 3.4.0 (2017-04-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux Server release 6.5 (Santiago) Matrix products: default BLAS: /apps/lib-osver/R/3.4.0/lib64/R/lib/libRblas.so LAPACK: /apps/lib-osver/R/3.4.0/lib64/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] showtext_0.5-1 showtextdb_2.0 sysfonts_0.7.2 loaded via a namespace (and not attached): [1] getPass_0.2-2 digest_0.6.15 crayon_1.3.4 [4] IRdisplay_0.4.4 repr_0.12.0 jsonlite_1.5 [7] magrittr_1.5 evaluate_0.10.1 stringi_1.1.6 [10] curl_3.0 uuid_0.1-2 IRkernel_0.8.10.9000 [13] Cairo_1.5-9 tools_3.4.0 stringr_1.3.0 [16] compiler_3.4.0 pbdZMQ_0.3-2
yixuan commented 6 years ago

I am not 100% sure, but have you tried to use the showtext_auto() function to automatically enable showtext?

slowkow commented 6 years ago

I have, and it doesn't work. Thanks for the suggestion!