Cropped plot labels in knitted PDF's in Linux

Has anyone experienced having their plot labels cropped in knitted PDF's in Linux? This does not happen in my Windows machine.

Here is a minimal example to replicate this problem.

    keep_tex: true

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

```{r pressure, echo=FALSE}

Here is the output.

enter image description here

I have submitted this as a bug report here.

R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: elementary OS 0.4.1 Loki

Matrix products: default
BLAS: /usr/lib/libblas/
LAPACK: /usr/lib/lapack/

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              

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

loaded via a namespace (and not attached):
 [1] tseries_0.10-44        httr_1.3.1             tufte_0.3             
 [4] tidyr_0.8.0            jsonlite_1.5           uroot_2.0-9           
 [7] modelr_0.1.1           assertthat_0.2.0       TTR_0.23-3            
[10] selectr_0.4-1          cellranger_1.1.0       yaml_2.1.18           
[13] progress_1.2.0         pillar_1.2.2           backports_1.1.2       
[16] lattice_0.20-35        glue_1.2.0             quadprog_1.5-5        
[19] digest_0.6.15          rvest_0.3.2            colorspace_1.3-2      
[22] htmltools_0.3.6        plyr_1.8.4             psych_1.8.3.3         
[25] timeDate_3043.102      pkgconfig_2.0.1        broom_0.4.4           
[28] haven_1.1.1            purrr_0.2.4            scales_0.5.0.9000     
[31] git2r_0.21.0           tibble_1.4.2           ggplot2_2.2.1.9000    
[34] withr_2.1.2            urca_1.3-0             nnet_7.3-12           
[37] ansistrings_1.0.0.9000 lazyeval_0.2.1         cli_1.0.0.9002        
[40] quantmod_0.4-13        mnormt_1.5-5           magrittr_1.5          
[43] crayon_1.3.4           readxl_1.1.0           memoise_1.1.0         
[46] evaluate_0.10.1        nlme_3.1-131.1         forcats_0.3.0         
[49] xts_0.10-2             xml2_1.2.0             foreign_0.8-69        
[52] rsconnect_0.8.8        tools_3.4.4            prettyunits_1.0.2     
[55] hms_0.4.2              stringr_1.3.0          munsell_0.4.3         
[58] bindrcpp_0.2.2         compiler_3.4.4         rlang_0.2.0.9001      
[61] grid_3.4.4             rstudioapi_0.7         labeling_0.3          
[64] rmarkdown_1.9          gtable_0.2.0           fracdiff_1.4-2        
[67] curl_3.2               reshape2_1.4.3         R6_2.2.2              
[70] zoo_1.8-1              lubridate_1.7.4        knitr_1.20            
[73] dplyr_0.7.4            utf8_1.1.3             bindr_0.1.1           
[76] rprojroot_1.3-2        readr_1.1.1            stringi_1.1.7         
[79] parallel_3.4.4         Rcpp_0.12.16           lmtest_0.9-36 

Have you tried installing the tinytex package and then producing the pdf?

I just did, but nothing happened. I also have a full vanilla installation of TeXLive 2017.

Please edit your code as follows:

{r pressure, out.width = "300px", fig.align='center', echo=FALSE}

Try different values of out.width.

@yihui currently recommends that you uninstall your existing TeX installation while using tinytex, and IIRC other users here have had problems trying to knit documents while running both side-by-side. Might not be the cause of your problems, though!

My guess is that this is irrelevant to LaTeX, but a pure R issue. And it is likely to be a font config issue. I have never used (or even heard of) elementary OS, so I don't know.

Elementary OS is based on Ubuntu 16.04. I will test it on that and see if I see the same results. Also, FWIW, this may have something to do with my pandoc version, which is the default in most Linux distributions.

pandoc -v
Compiled with pandoc-types, texmath 0.9, skylighting

Have you made any changes in the .Rprofile file?
Try deleting this file. It will be a hiddem file. After deleting, start Rstudio.

No, there is nothing in my .Rprofile that causes this behavior. I tried deleting it, but the same behavior remains.