-
-
Notifications
You must be signed in to change notification settings - Fork 87
add quantile dot plot functions #357
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
Conversation
I didn't realize there would be this sort of difficulty with the dot plots. I think handling those edge cases and having appropriate warnings is probably enough of a benefit to add ggdist dependency and maybe we can also use ggdist for other plots in the future. For now we could just add it to Suggests (instead of Imports) and then use our internal |
This solution makes sense to me. If @TeemuSailynoja or @avehtari don't have any objection, I can work on this. |
I like ggdist, so I'm fine using it more |
I think adding ggdist as a suggested package is very good for this. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #357 +/- ##
==========================================
- Coverage 98.64% 98.62% -0.03%
==========================================
Files 35 35
Lines 5550 5600 +50
==========================================
+ Hits 5475 5523 +48
- Misses 75 77 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I still need to actually play around with the functions and try using them to make some plots (I will try to do that soon), but the code is looking good. I made a few small review comments and, in addition to those, two other things:
-
It looks like several tests are failing. Can you look into why they're failing?
-
Can you regenerate the documentation using
devtools::document()
. That will regenerate the user manual pages (the .Rd files in theman
directory) based on the documentation you put in the R files. -
Thinking about the name for this function, maybe we should just call it
ppc_dots()
. Does anyone have a strong preference?
Thanks, I'll look into all of these and update the code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @behramulukir. Just two things:
-
Can you run
devtools::document()
to regenerate the.Rd
files and the NAMESPACE file? Right now you have the documentation written in the .R file, which looks good, but it doesn't actually get added to the user manual until the .Rd file is updated from the R file. And the function won't be exported for users until it's listed in the NAMESPACE file. Runningdevtools::document()
will do both of those things for you. -
Do you know why the visual tests comparing the SVGs are failing? We should get those to pass before merging this. You may need to use
testthat::snapshot_review()
.
Otherwise this looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @behramulukir! I'm going to merge this now.
As I mentioned at #354 I have been working on adding quantile dot plots. It was more complicated than I was expecting, so I wanted to make sure about the direction of this.
Current Progress
So far, I have implemented two functions,
ppc_qdotplot
which under the hood utilisesgeom_dotplot
andppc_qdotplot_ggdist
which utilisesstat_dots
fromggdist
.qdotplot
This function utilises
geom_dotplot
, which gives a very simple way to build dot plots.geom_dotplot
function has two main deficiencies:geom_dotplot
doesn't have a proper auto-sizing for dots, the visual is getting clipped and not presenting the full picture.To minimise the first problem, I implemented a simple auto-sizing algorithm which performs well when the bin width is not specified or very reasonably specified; however, when it is even a little unsuitable, it is likely to run into issues. Here are some example uses of
ppc_qdotplot
:As you can see, for certain bin widths, dots are over-compressed or exceed the limit of the graphic.
qdotplot_ggdist
The second alternative relies on
stat_dots
fromggdist
. It is slightly more successful overall in handling edge cases and has a warning system; however, it also brings additional dependency to the package, making me unsure if we want to go that route. The advantages of this overqdotplot
are:In the previous three graphics where the dots do not fit into the visual, the following error is thrown at the console:
ppc_qdotplot_ggdist
can be used with quantiles as follows:Future
To move forward, I think we need to decide on which function we want to keep and whether we want to add
ggdist
dependency. After that, I can remove the unnecessary function and continue with the rest of the implementation.geom_dotplot
versionstat_dots