Skip to content

Commit

Permalink
Remove all ggplot2 functionality
Browse files Browse the repository at this point in the history
Resolves #62
  • Loading branch information
mitchelloharawild committed Dec 6, 2023
1 parent b466ccd commit 4d6eb3f
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 1,019 deletions.
20 changes: 0 additions & 20 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ S3method(generate,dist_uniform)
S3method(generate,dist_weibull)
S3method(generate,dist_wrap)
S3method(generate,distribution)
S3method(guide_gengrob,guide_level)
S3method(guide_geom,guide_level)
S3method(guide_train,level_guide)
S3method(hdr,default)
S3method(hdr,dist_default)
S3method(hdr,distribution)
Expand Down Expand Up @@ -386,7 +383,6 @@ S3method(quantile,dist_uniform)
S3method(quantile,dist_weibull)
S3method(quantile,dist_wrap)
S3method(quantile,distribution)
S3method(scale_type,hilo)
S3method(skewness,dist_bernoulli)
S3method(skewness,dist_beta)
S3method(skewness,dist_binomial)
Expand Down Expand Up @@ -482,9 +478,6 @@ export(dist_uniform)
export(dist_weibull)
export(dist_wrap)
export(generate)
export(geom_hilo_linerange)
export(geom_hilo_ribbon)
export(guide_level)
export(hdr)
export(hilo)
export(is_distribution)
Expand All @@ -497,25 +490,12 @@ export(new_dist)
export(new_hdr)
export(new_hilo)
export(parameters)
export(scale_hilo_continuous)
export(scale_level_continuous)
export(skewness)
export(support)
export(variance)
import(rlang)
import(vctrs)
importFrom(farver,convert_colour)
importFrom(generics,generate)
importFrom(ggplot2,discrete_scale)
importFrom(ggplot2,guide_colourbar)
importFrom(ggplot2,guide_gengrob)
importFrom(ggplot2,guide_geom)
importFrom(ggplot2,guide_legend)
importFrom(ggplot2,guide_train)
importFrom(ggplot2,scale_type)
importFrom(ggplot2,waiver)
importFrom(grDevices,col2rgb)
importFrom(grDevices,rgb)
importFrom(lifecycle,deprecate_soft)
importFrom(lifecycle,deprecated)
importFrom(stats,density)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# distributional (development version)

## Breaking changes

* All graphics related functionality has been removed from the package in favour
of the ggdist (https://cran.r-project.org/package=ggdist) package. This
breaking change was done to substantially reduce the package's dependencies,
focusing the functionality on representing vectors of distributions.

# distributional 0.3.2

Small patch to resolve issues with CRAN checks.
Expand Down
186 changes: 0 additions & 186 deletions R/geom_hilo.R

This file was deleted.

68 changes: 0 additions & 68 deletions R/hilo.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,71 +178,3 @@ vec_arith.numeric.hilo <- function(op, x, y, ...){
# abort("A <hilo> object cannot be named.")
x
}

# Graphics ---------------------------------------------------------------------

#' @importFrom ggplot2 scale_type
#' @export
scale_type.hilo <- function(x){
"continuous"
}

#' Hilo interval scales
#'
#' @inheritParams ggplot2::scale_y_continuous
#'
#' @export
scale_hilo_continuous <- function(name = waiver(), breaks = waiver(),
minor_breaks = waiver(), n.breaks = NULL,
labels = waiver(), limits = NULL,
expand = waiver(), oob = identity,
na.value = NA, trans = "identity",
guide = waiver(), position = "left",
sec.axis = waiver()) {

sc <- ggplot2::scale_y_continuous(
name = name, breaks = breaks, minor_breaks = minor_breaks, n.breaks = n.breaks,
labels = labels, limits = limits, expand = expand, oob = oob,
na.value = na.value, trans = trans, guide = guide, position = position,
sec.axis = sec.axis
)

ggplot2::ggproto(
NULL, sc,
aesthetics = c("hilo"),
map = function(self, x, limits = self$get_limits()) {
scaled <- self$oob(x, limits)
scaled[is.na(scaled)] <- self$na.value
scaled
},
oob = function(x, range = c(0, 1), only.finite = TRUE){
force(range)
finite <- if (only.finite)
is.finite(x)
else TRUE
dt <- vec_data(x)
x[finite & dt$lower < range[1]] <- NA
x[finite & dt$upper > range[2]] <- NA
x
},
clone = function(self) {
new <- ggplot2::ggproto(NULL, self)
new$range <- hilo_range()
new
},
range = hilo_range()
)
}

RangeHilo <- ggplot2::ggproto("RangeHilo", NULL,
train = function(self, x) {
self$range <- scales::train_continuous(c(vec_data(x)$lower, vec_data(x)$upper), self$range)
},
reset = function(self) {
self$range <- NULL
}
)

hilo_range <- function() {
ggplot2::ggproto(NULL, RangeHilo)
}
19 changes: 0 additions & 19 deletions R/plot.R

This file was deleted.

Loading

0 comments on commit 4d6eb3f

Please sign in to comment.