Skip to content

Commit f6dc330

Browse files
use explicit 'ggplot2' imports
1 parent cdd041a commit f6dc330

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

NAMESPACE

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,33 @@ exportMethods(rotate)
99
exportMethods(scale)
1010
exportMethods(translation)
1111
import(SpatialData)
12-
import(ggplot2)
1312
importFrom(DelayedArray,realize)
1413
importFrom(S4Vectors,metadata)
1514
importFrom(SingleCellExperiment,int_metadata)
1615
importFrom(dplyr,mutate)
1716
importFrom(dplyr,select)
1817
importFrom(ggforce,geom_circle)
18+
importFrom(ggplot2,aes)
19+
importFrom(ggplot2,annotation_raster)
20+
importFrom(ggplot2,coord_equal)
21+
importFrom(ggplot2,element_blank)
22+
importFrom(ggplot2,element_line)
23+
importFrom(ggplot2,element_text)
24+
importFrom(ggplot2,geom_point)
25+
importFrom(ggplot2,geom_polygon)
26+
importFrom(ggplot2,geom_tile)
27+
importFrom(ggplot2,ggplot)
28+
importFrom(ggplot2,guide_legend)
29+
importFrom(ggplot2,guides)
30+
importFrom(ggplot2,scale_color_gradientn)
31+
importFrom(ggplot2,scale_fill_gradientn)
32+
importFrom(ggplot2,scale_fill_manual)
33+
importFrom(ggplot2,scale_type)
34+
importFrom(ggplot2,scale_x_continuous)
35+
importFrom(ggplot2,scale_y_reverse)
36+
importFrom(ggplot2,theme)
37+
importFrom(ggplot2,theme_bw)
38+
importFrom(ggplot2,unit)
1939
importFrom(grDevices,col2rgb)
2040
importFrom(grDevices,colorRampPalette)
2141
importFrom(grDevices,hcl.colors)

R/plot.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ NULL
2929
#' @importFrom grDevices col2rgb
3030
.str_is_col <- \(x) !inherits(tryCatch(error=\(e) e, col2rgb(x)), "error")
3131

32+
#' @importFrom ggplot2
33+
#' coord_equal theme_bw theme
34+
#' element_blank element_text element_line
3235
.theme <- list(
3336
coord_equal(), theme_bw(), theme(
3437
panel.grid=element_blank(),
@@ -40,6 +43,7 @@ NULL
4043
)
4144

4245
#' @rdname plotImage
46+
#' @importFrom ggplot2 ggplot scale_y_reverse
4347
#' @export
4448
plotSpatialData <- \() ggplot() + scale_y_reverse() + .theme
4549

@@ -77,7 +81,10 @@ plotSpatialData <- \() ggplot() + scale_y_reverse() + .theme
7781
list(w=wh[, 1], h=wh[, 2])
7882
}
7983

80-
#' @import ggplot2
84+
#' @importFrom ggplot2
85+
#' scale_x_continuous
86+
#' scale_x_continuous
87+
#' annotation_raster
8188
.gg_i <- \(x, w, h, dpi) list(
8289
scale_x_continuous(limits=w), scale_y_reverse(limits=rev(h)),
8390
annotation_raster(x, w[2],w[1], -h[1],-h[2], interpolate=FALSE))

R/plotLabel.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ NULL
3636
#' @importFrom S4Vectors metadata
3737
#' @importFrom rlang .data
3838
#' @importFrom methods as
39+
#' @importFrom ggplot2
40+
#' scale_fill_manual scale_fill_gradientn
41+
#' aes geom_tile theme unit guides guide_legend
3942
#' @export
4043
setMethod("plotLabel", "SpatialData", \(x, i=1, c=NULL,
4144
a=0.5, pal=c("red", "green"), nan=NA, assay=1) {

R/plotPoint.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ NULL
3333
#' @importFrom methods is
3434
#' @importFrom grDevices hcl.colors
3535
#' @importFrom SingleCellExperiment int_metadata
36+
#' @importFrom ggplot2
37+
#' geom_point scale_color_gradientn
38+
#' aes theme guides guide_legend scale_type
3639
.gg_p <- \(x, c, s, a, ...) {
3740
dots <- list(...)
3841
i <- dots$i

R/plotShape.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ NULL
3232

3333
#' @rdname plotShape
3434
#' @importFrom sf st_as_sf st_coordinates st_geometry_type
35+
#' @importFrom ggplot2 aes theme scale_type geom_polygon
3536
#' @importFrom ggforce geom_circle
3637
#' @importFrom utils tail
3738
#' @export

0 commit comments

Comments
 (0)