ProjectMOSAIC / ggformula

Provides a formula interface to 'ggplot2' graphics.
Other
38 stars 11 forks source link

gf_vline() and the like after ggplot2 update to 2.3.0: value setting #126

Closed luebby closed 5 years ago

luebby commented 5 years ago

After updating ggplot2 the following seems not to work any longer (from ?gf_vline):

gf_point(wt ~ hp, size = ~wt, color = ~cyl, data = mtcars) %>%
  gf_abline(slope = 0, intercept = 3, color = "green", data = NA)

workaround - or intended (?):

gf_point(wt ~ hp, size = ~wt, color = ~cyl, data = mtcars) %>%
  gf_abline(slope = ~ 0, intercept = ~ 3, color = "green", data = NA)
> packageVersion("ggplot2")
[1] ‘3.2.0’
> packageVersion("ggformula")
[1] ‘0.9.1.9001’
rpruim commented 5 years ago

Can you define "not to work"? When I run your example, I get a (new?) warning, but the plot does work as expected. But I'll keep my eye on this as I'm in an active maintenance phase and expect a new CRAN release soon.

suppressPackageStartupMessages(library(ggformula))
gf_point(wt ~ hp, size = ~wt, color = ~cyl, data = mtcars) %>%
  gf_abline(slope = 0, intercept = 3, color = "green", data = NA)
#> Warning in (function (mapping = NULL, data = NULL, ..., slope, intercept, : Using `intercept` and/or `slope` with `mapping` may not have the desired result as mapping is overwritten if either of these is specified

Created on 2019-06-20 by the reprex package (v0.3.0)

luebby commented 5 years ago

I did not put my error message as it was in German - sorry! I should have also used reprex()...

For me quite interesting: now I also only get the same warning - no error. Maybe (?) the trouble was only caused by another package which was attached in that session - and I can not reproduce this. Sorry. I will also continue checking but you can close if you want. (For me the warning is new...)

rpruim commented 5 years ago

Since I can read German, it would have been fine for the error to be in German. If it does happen again, let me know. You have me curious now.

But I'm glad things are working. I'll keep this open a bit longer while explore if/how I want to deal with the new warning.

rpruim commented 5 years ago

I think I'm going to deem the current state acceptable and close this for now. Examples in documentation address how to avoid getting warnings by using formulas.

luebby commented 5 years ago

Today 2-3 students of mine run into error message (not only the warning) while knitting Rmd with xintercept = 0. During the lecture I only offered the solution viaxintercept = ~ 0 but could not investigate further. Keep my eyes open.

luebby commented 5 years ago

Actually one of them saved the error (German: Fehler) message:

#Fehler: Please use `data_frame()` or `new_data_frame()` instead of `data.frame()` for better #performance. See the vignette "ggplot2 internal programming guidelines" for details.

Funny: should be a warning not an error (?)

rubak commented 5 years ago

I was seeing this error message today as well when using the CRAN version. Disappeared when I updated to the GitHub version. I fear that my students will encounter the problem in class tomorrow as well. Any news on when the CRAN version will be updated?