Closed lebebr01 closed 4 years ago
Hmm.. I thought I had posted a response to this long ago. I must have been interrupted before submitting the comment. My apologies for the long delayed answer.
ggformula does export layer_factory()
, and it can be used to create new gf_
functions.
library(ggforce)
#> Loading required package: ggplot2
library(ggformula)
#> Loading required package: ggstance
#>
#> Attaching package: 'ggstance'
#> The following objects are masked from 'package:ggplot2':
#>
#> geom_errorbarh, GeomErrorbarh
#>
#> New to ggformula? Try the tutorials:
#> learnr::run_tutorial("introduction", package = "ggformula")
#> learnr::run_tutorial("refining", package = "ggformula")
gf_sina <- layer_factory(geom = "point", stat = "sina")
gf_sina(age ~ substance, data = mosaicData::HELPrct)
Created on 2020-02-07 by the reprex package (v0.3.0)
I'll be submitting a new version of ggformula to CRAN soon. I could perhaps add gf_sina()
in that release.
Yes, do. The people at my JMM workshop suggested a plot like this.
On Thu, Feb 6, 2020 at 9:05 PM Randall Pruim notifications@github.com wrote:
I'll be submitting a new version of ggformula to CRAN soon. I could perhaps add gf_sina() in that release.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ProjectMOSAIC/ggformula/issues/134?email_source=notifications&email_token=AAECBLLOCGFVOMSQHRXWYSLRBTT2NA5CNFSM4JJ33432YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELBXUOQ#issuecomment-583236154, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECBLJANPQT7FTUSUJ7QTTRBTT2NANCNFSM4JJ3343Q .
Thank you, I appreciate your time on this!
done. Well at least the code part. Need to check documentation and add tests.
library(ggformula)
#> Loading required package: ggplot2
#> Loading required package: ggstance
#>
#> Attaching package: 'ggstance'
#> The following objects are masked from 'package:ggplot2':
#>
#> geom_errorbarh, GeomErrorbarh
#>
#> New to ggformula? Try the tutorials:
#> learnr::run_tutorial("introduction", package = "ggformula")
#> learnr::run_tutorial("refining", package = "ggformula")
example(gf_sina)
#>
#> gf_sin> gf_sina(age ~ substance, data = mosaicData::HELPrct)
Created on 2020-02-07 by the reprex package (v0.3.0)
I'm adding an example use of gg_sina()
(overlaid on a violin plot) to ggformula.Rmd.
library(ggformula)
#> Loading required package: ggplot2
#> Loading required package: ggstance
#>
#> Attaching package: 'ggstance'
#> The following objects are masked from 'package:ggplot2':
#>
#> geom_errorbarh, GeomErrorbarh
#>
#> New to ggformula? Try the tutorials:
#> learnr::run_tutorial("introduction", package = "ggformula")
#> learnr::run_tutorial("refining", package = "ggformula")
theme_set(theme_bw())
gf_violin(age ~ substance, data = mosaicData::HELPrct) %>%
gf_sina(alpha = 0.3)
Created on 2020-02-11 by the reprex package (v0.3.0)
@rpruim This may be related to a point raised in issue #29 , where I can't find the function,
gf_factory()
. I'm trying to create a new function,gf_sina()
usinggeom_sina()
from the ggforce package: sina plots. With @zief0002 we are creating some materials for an intro stat audience and would like to have sina plots over violin plots.I believe I created a similar structure in my forked repo to mimic code from the ggstance.R file, my attempt at gf_sina. I get the following error:
A few questions:
gf_*
functions?Thanks in advance for your assistance.