mitchelloharawild / distributional

Vectorised distributions for R
https://pkg.mitchelloharawild.com/distributional
GNU General Public License v3.0
94 stars 15 forks source link

Improve plotting method #2

Closed mitchelloharawild closed 4 years ago

mitchelloharawild commented 4 years ago

Currently the plotting method simply shows equally spaced points on the pdf/cdf. For many distributions this is insufficient - the spacing should be concentrated on positions of change.

The example below shows a zero-inflated normal, however the zero is not shown due to the equal spacing.

MRE:

library(distributional)
library(ggplot2)
autoplot(distributional:::dist_inflated(dist_normal(), 0.5))

Created on 2020-01-21 by the reprex package (v0.3.0)

mitchelloharawild commented 4 years ago

Note the CDF:

library(distributional)
library(ggplot2)
autoplot(distributional:::dist_inflated(dist_normal(), 0.5), "cdf")

Created on 2020-01-21 by the reprex package (v0.3.0)

mitchelloharawild commented 4 years ago

Graphics will be handled by the {ggdist} package.