wilkelab / ggtext

Improved text rendering support for ggplot2
https://wilkelab.org/ggtext/
GNU General Public License v2.0
657 stars 37 forks source link

Issue running sample element_markdown() for adding pictures as x labels #75

Open giraffehere opened 3 years ago

giraffehere commented 3 years ago

Running this example code here:

labels <- c(
  setosa = "<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Iris_setosa.JPG/180px-Iris_setosa.JPG'
    width='100' /><br>*I. setosa*",
  virginica = "<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Iris_virginica_-_NRCS.jpg/320px-Iris_virginica_-_NRCS.jpg'
    width='100' /><br>*I. virginica*",
  versicolor = "<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/20140427Iris_versicolor1.jpg/320px-20140427Iris_versicolor1.jpg'
    width='100' /><br>*I. versicolor*"
)

ggplot(iris, aes(Species, Sepal.Width)) +
  geom_boxplot() +
  scale_x_discrete(
    name = NULL,
    labels = labels
  ) +
  theme(
    axis.text.x = element_markdown(color = "black", size = 11)
  )

Running into this error:

Error in function (type, msg, asError = TRUE)  : 
  error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

Unsure what could be causing. Here's my session info:

 sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

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

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

other attached packages:
 [1] Rcpp_1.0.7         png_0.1-7          ggtext_0.1.1       ggplot2_3.3.3      wordcloud2_0.2.1   wordcloud_2.6      RColorBrewer_1.1-2
 [8] rjson_0.2.20       stringr_1.4.0      openxlsx_4.2.3     dplyr_1.0.6        plyr_1.8.6         reshape2_1.4.4     reshape_0.8.8     
[15] lubridate_1.7.10   data.table_1.14.0 

loaded via a namespace (and not attached):
 [1] zip_2.1.1         pillar_1.6.1      compiler_4.0.5    bitops_1.0-7      tools_4.0.5       digest_0.6.27     lifecycle_1.0.0   tibble_3.1.1     
 [9] gtable_0.3.0      pkgconfig_2.0.3   rlang_0.4.11      withr_2.4.2       xml2_1.3.2        generics_0.1.0    vctrs_0.3.8       htmlwidgets_1.5.3
[17] grid_4.0.5        gridtext_0.1.4    tidyselect_1.1.1  glue_1.4.2        R6_2.5.0          jpeg_0.1-9        fansi_0.4.2       farver_2.1.0     
[25] purrr_0.3.4       magrittr_2.0.1    htmltools_0.5.1.1 scales_1.1.1      ellipsis_0.3.2    colorspace_2.0-1  labeling_0.4.2    utf8_1.2.1       
[33] stringi_1.5.3     RCurl_1.98-1.5    munsell_0.5.0     markdown_1.1      crayon_1.4.1     
clauswilke commented 3 years ago

Could you try the current development version? Install with remotes::install_github("wilkelab/ggtext").

giraffehere commented 3 years ago

Seeing the same error:

> labels <- c(
+   setosa = "<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Iris_setosa.JPG/180px-Iris_setosa.JPG'
+     width='100' /><br>*I. setosa*",
+   virginica = "<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Iris_virginica_-_NRCS.jpg/320px-Iris_virginica_-_NRCS.jpg'
+     width='100' /><br>*I. virginica*",
+   versicolor = "<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/20140427Iris_versicolor1.jpg/320px-20140427Iris_versicolor1.jpg'
+     width='100' /><br>*I. versicolor*"
+ )
> 
> ggplot(iris, aes(Species, Sepal.Width)) +
+   geom_boxplot() +
+   scale_x_discrete(
+     name = NULL,
+     labels = labels
+   ) +
+   theme(
+     axis.text.x = element_markdown(color = "black", size = 11)
+   )
Error in function (type, msg, asError = TRUE)  : 
  error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

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

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

other attached packages:
 [1] cli_3.0.1          xfun_0.26          Rcpp_1.0.7         png_0.1-7          ggtext_0.1.1       ggplot2_3.3.5      wordcloud2_0.2.1  
 [8] wordcloud_2.6      RColorBrewer_1.1-2 rjson_0.2.20       stringr_1.4.0      openxlsx_4.2.3     dplyr_1.0.6        plyr_1.8.6        
[15] reshape2_1.4.4     reshape_0.8.8      lubridate_1.7.10   data.table_1.14.0 

loaded via a namespace (and not attached):
 [1] zip_2.1.1         pillar_1.6.4      compiler_4.0.5    bitops_1.0-7      remotes_2.4.1     tools_4.0.5       digest_0.6.28     lifecycle_1.0.1  
 [9] tibble_3.1.5      gtable_0.3.0      pkgconfig_2.0.3   rlang_0.4.12      xml2_1.3.2        withr_2.4.2       generics_0.1.0    vctrs_0.3.8      
[17] htmlwidgets_1.5.3 gridtext_0.1.4    grid_4.0.5        tidyselect_1.1.1  glue_1.4.2        R6_2.5.1          jpeg_0.1-9        fansi_0.5.0      
[25] farver_2.1.0      purrr_0.3.4       magrittr_2.0.1    scales_1.1.1      ellipsis_0.3.2    htmltools_0.5.1.1 colorspace_2.0-2  labeling_0.4.2   
[33] utf8_1.2.2        stringi_1.7.5     RCurl_1.98-1.5    munsell_0.5.0     markdown_1.1      crayon_1.4.1 

The remote install installs without error (was not able to load from source however for xfun and cli if that could be an issue).