-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
side effect errors since 3.4.0 : scale_x_continuous() with user provided trans object now explicitly calls the transform function with domain edges as input #5105
Comments
Do you happen to know where in the ggplot2 code this additional call was inserted? It may help us figure out why this change was introduced. |
I found it here: Line 644 in 63125db
|
This was done as part of #4775, to ensure break calculations can be performed when expanded limits exceeded the domain. I think if a transformation has known limits, e.g. [-1.0e99, 1.0e99], than that should be the domain of the transformation. However, I don't know whether the logicle transformation has known limits. |
The domain of the logicle transformation is ]-Inf, +Inf[ |
I think it's reasonable to expect transformations to be able to transform their domain. Inf values are allowed, so the log transformation for example should return -Inf, Inf when asked to transform its domain. I can't think of any mathematical situation where a transformation wouldn't be able to handle its domain edges, under the condition that infinite values are possible as return values. Maybe this should be adopted as a formal position and added to the documentation in the scales package. |
Issue closed and replaced by: r-lib/scales#375 Specific problem with ggcyto was handled in: RGLab/ggcyto#88 Thanks @clauswilke and @teunbrand for your help ! |
Hi,
Since 3.4.0 I am getting error messages from some extensions of scale_x_continuous() that are implemented in third parties packages. For the record, the 3rd party package I am using is ggcyto and the function I am using is scale_x_logicle() which just provides a specific transformation function to scale_x_continuous using trans = scales::trans_new(ggcyto_object).
Digging into the issue, I found that when displaying the plot, ggplot2 now calls, among the numerous calls to the transformation function or its inverse, the transformation function explicitely with the domain edges as input, which is by default c(-Inf, +Inf). This has as side effect that the transformation functions that are not robust for extreme values, may crash or raise an error message. This explicit call to the transform function, with the domain edges values as input, was not done in version 3.3.6, so I don't get why this might now be necessary.
Herebelow is a minimal reprex, using a dummy transformation function, which just implements the identity function, but raises an error when extreme values are passed. This example works without any concern with ggplot2 version 3.3.6, but raises the error message "extreme value passed => convergence problem!" with ggplot2 version 3.4.0
Could you possibly have a look and advise ?
Thx,
Philippe
The text was updated successfully, but these errors were encountered: