R-Lum/Luminescence

plot_RadialPlot: display problem with log.z = FALSE combined with 0 or negative values

Closed this issue · 4 comments

Expected behaviour

radial scale should go from -1 to 4
data should have values of 0, 1 and 2

Observed behaviour

radial scale goes from -2 to 3
data have values of -1, 0 and 1

Running mini example

x <- data.frame("x" = c(0,1,2), "y" = c(0.1,0.1,0.1))
plot_RadialPlot(x, zlim = c(-1,4), log.z = FALSE)

library(Luminescence)

Hello!

there is one problem. Possibility two here, highlighted in the sort examples below.

other examples

x <- data.frame("x" = c(0,1,2), "y" = c(0.1,0.1,0.1))
plot_RadialPlot(x, log.z = FALSE)

all good


however

x <- data.frame("x" = c(1,2,3), "y" = c(0.1,0.1,0.1))
plot_RadialPlot(x, zlim = c(-1,4), log.z = FALSE)

all good


x <- data.frame("x" = c(-1,2,3), "y" = c(0.1,0.1,0.1))
plot_RadialPlot(x, zlim = c(-1,4), log.z = FALSE)

radial scale goes from -2 to 3
data have values of -2, 1 and 2


x <- data.frame("x" = c(-1,2,3), "y" = c(0.1,0.1,0.1))
plot_RadialPlot(x, log.z = FALSE)

WOW!! words cannot describe what I just saw!


@SebastienHuot Thanks for double-checking our package. It's indeed a bug.

@coffeemuggler This comes from the negative value handling, we had discussed this once, but, I guess we never solved it correctly. Do you think you can fix this until the end of August? I got some pressure again from CRAN because of another issue and I will submit a new version of the package soon.

@coffeemuggler I double-checked the old commit you made in 2016 29f88ea. Unfortunately, I cannot make much sense out of it.
If I exclude the relevant lines

## calculate correction dose to shift negative values
if(min(De.global) <= 0) {
if("zlim" %in% names(extraArgs)) {
De.add <- abs(extraArgs$zlim[1])
} else {
## estimate delta De to add to all data
De.add <- min(10^ceiling(log10(abs(De.global))) * 10)
## optionally readjust delta De for extreme values
if(De.add <= abs(min(De.global))) {
De.add <- De.add * 10
}
}
} else {
De.add <- 0
}

the plot becomes just fine, it crashes only for z.log = TRUE (which makes still sense). So, what should we do? In the meantime, I had two other users complaining and then people start thinking that they cannot trust the plot in general.

@coffeemuggler Big thanks for the fix! I grabbed it from dev_0.9.0 via cherry-pick and deleted the branch again.
@SebastienHuot Can you please double-check whether the function now works correctly?