distributions3 icon indicating copy to clipboard operation
distributions3 copied to clipboard

Refactoring plotting

Open alexpghayes opened this issue 2 years ago • 1 comments

Where I'm at so far:

  • I think having plot_pdf() and plot_cdf() are valuable even if there is some code repetition because the names are the most clear, and beginners in my experience have struggled with function arguments (i.e. type = "cdf" vs type = "pdf"), and we can take away that potential snag via specialized functions names at little additional maintenance cost.

  • I don't think that having two distinct plotting systems is beginning friendly. I think it is important that there is one canonical way to do things in this package. I'm actually increasingly convinced aliasing plot() and autoplot() is going to cause beginner confusion.

  • I don't particularly mind a ggplot2 hard dependency.

alexpghayes avatar Feb 22 '22 01:02 alexpghayes

  • If you want to have separate plot_pdf() and plot_cdf() functions, I would implement these as simple convenience interfaces to the more flexible underlying plot() function. Essentially plot_pdf <- function(x, ...) plot(x, what = "pdf", ..) or something like that. This keeps the code DRY and facilitates maintenance while still providing shortcuts for beginners.
  • Many teachers will not have covered ggplot2 when using this package for basic probability theory - and conversely many teachers will not go into base graphics but only cover ggplot2. So I would be inclusive to all of these and provide infrastructure for both plotting paradigms. This necessitates some explanation for beginners but I think that even most of them are quickly aware of that both systems exist and work rather differently.
  • I'm not particularly worried about a ggplot2 dependency. I just think that so far it can be avoided relatively easily without disadvantages for those who want to use it. The benefit would be a leaner list of inherited dependencies for for future reverse dependencies that are likely to use mostly the distributional functionality and not necessarily the visualization infrastructure.

zeileis avatar Feb 22 '22 02:02 zeileis