[R-sig-Debian] problem with `viridis` on Ubuntu 20.04

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Thu Apr 30 01:39:15 CEST 2020

On 30 April 2020 at 01:24, Samuele Carcagno wrote:
| I've hit a bug on Ubuntu 20.04. The issue occurred both with the R 
| version that shipped with Ubuntu last week, and it is occurring now with 
| the CRAN packages from one of the mirros (deb 
| http://cran.mirror.garr.it/mirrors/CRAN/bin/linux/ubuntu/ 
| focal-cran40/). The issue occurs whether I use the deb package for 
| viridis in the Ubuntu repos, or I install it with `install.packages()` in R.
| The issue is that when I call a function from the 'viridis' package 
| (e.g. running the first example in the `viridis` vignette: 
| https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html) 
| R gets stuck indefinitely; the system monitor shows the R process using 
| CPU resources but nothing happens at the terminal and I'm also unable to 
| stop the function with Ctrl-C.
| I did a little digging and simply calling the function `viridis` from 
| the `viridisLite` package causes the same problem, execution gets stuck 
| at the line:
|      cols <- fn_cols(seq(begin, end, length.out = n)) / 255
| which is line 177 here: 
| https://github.com/sjmgarnier/viridisLite/blob/master/R/viridis.R#L177
| I'm dual booting Debian Buster on the same machine and no such issue 
| occurs with R 4.0.0 and the same versions of the `viridis` and 
| `viridisLite` packages. Also no such issue occurs on Windows 10 or on a 
| Mac both with R 4.0.0 and the latest versions of `viridis` and 
| `viridisLite`.
| I was not sure where should I report the bug, so I thought of asking for 
| advice here first.

Can we make it reproducible, please?  Can you provide a minimal script with
values for begin, end, n, ... etc pp or a concrete call?

I got lost in your description above between what version of R from where you
ran with which package or function.

Keep. It. Simple. And. Concise.

And reproducible.

For what it is worth, it _works for me with R 4.0.0 on Ubuntu 19.10_ with the
binary .deb from my PPA (as blogged about, but should be identical to what
Michael built and ships via CRAN).  Log of a fresh Emacs session below. I
double Ubuntu 20.04 is different but "one never knows".

Thank you!


Log below

R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

There's an informal tradition that those announcements [about R releases] contain at least one mistake, but apparently I forgot this time, so users have to make up their own....
   -- Peter Dalgaard (about an apparent non-bug report in his former R-announce message)
      R-help (December 2009)

R> setwd('/home/edd/')
R> library(viridisLite)
R> example(viridis)

viridsR> library(ggplot2)

viridsR> library(hexbin)

viridsR> dat <- data.frame(x = rnorm(10000), y = rnorm(10000))

viridsR> ggplot(dat, aes(x = x, y = y)) +
virids+   geom_hex() + coord_fixed() +
virids+   scale_fill_gradientn(colours = viridis(256, option = "D"))
Hit <Return> to see next plot: 

viridsR> # using code from RColorBrewer to demo the palette
viridsR> n = 200

viridsR> image(
virids+   1:n, 1, as.matrix(1:n),
virids+   col = viridis(n, option = "D"),
virids+   xlab = "viridis n", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
virids+ )
Hit <Return> to see next plot: 

http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org

More information about the R-SIG-Debian mailing list