sjmgarnier / viridis

Colorblind-Friendly Color Maps for R
http://sjmgarnier.github.io/viridis
Other
286 stars 38 forks source link

loads tidyverse #64

Closed carbonmetrics closed 4 years ago

carbonmetrics commented 4 years ago

After loading viridis my namespace gets swamped with tidyverse packages:

> library(viridis)
Loading required package: viridisLite
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.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=nl_NL.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=nl_NL.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] viridis_0.5.1     viridisLite_0.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2       assertthat_0.2.1 dplyr_0.8.3     
 [4] crayon_1.3.4     R6_2.4.0         grid_3.6.1      
 [7] gtable_0.3.0     magrittr_1.5     scales_1.0.0    
[10] ggplot2_3.2.0    pillar_1.4.2     rlang_0.4.0     
[13] lazyeval_0.2.2   rstudioapi_0.10  tools_3.6.1     
[16] glue_1.3.1       purrr_0.3.2      munsell_0.5.0   
[19] compiler_3.6.1   pkgconfig_2.0.2  colorspace_1.4-1

Which creates bugs. Suddenly my variable vars creates an error because it is already claimed by dplyr:

> varlist=foreach(i=1:length(vars), .combine=rbind) %do% {
+   paste(unlist(vars[[i]]),collapse=", ")
+ } %>% as.data.table
Error in { : 
  task 1 failed - "object of type 'closure' is not subsettable"
> vars
function (...) 
{
    quos(...)
}
<bytecode: 0x562df220b678>
<environment: namespace:dplyr>

I do not use dplyr, purrr and tidyverse whatnot for exactly this reason. Why is viridis importing this? Is there a way around?

sjmgarnier commented 4 years ago

@carbonmetrics This is normal. viridis provides functions for ggplot2. If you just want to use the color palette, you should install viridisLite instead.

carbonmetrics commented 4 years ago

Thanks. I have found a good alternative in colorspace. It contains the viridis palettes, but does not mess around with my namespace.