Skip to content

Commit 82e12dd

Browse files
authored
Merge pull request #86 from william-hutchison/master
Improve `plot_ly`
2 parents cf66bf1 + 584b07f commit 82e12dd

File tree

4 files changed

+36
-60
lines changed

4 files changed

+36
-60
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: tidySummarizedExperiment
33
Title: Brings SummarizedExperiment to the Tidyverse
4-
Version: 1.11.6
4+
Version: 1.11.7
55
Authors@R: c(person("Stefano", "Mangiola", email = "mangiolastefano@gmail.com",
66
role = c("aut", "cre")) )
77
Description: The tidySummarizedExperiment package provides a set of tools for creating and
@@ -28,7 +28,6 @@ Imports:
2828
purrr,
2929
lifecycle,
3030
methods,
31-
plotly,
3231
utils,
3332
S4Vectors,
3433
tidyselect,
@@ -44,7 +43,8 @@ Suggests:
4443
BiocStyle,
4544
testthat,
4645
knitr,
47-
markdown
46+
markdown,
47+
plotly
4848
VignetteBuilder:
4949
knitr
5050
RdMacros:

NAMESPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ S3method(tidy,SummarizedExperiment)
3737
S3method(unite,SummarizedExperiment)
3838
S3method(unnest,tidySummarizedExperiment_nested)
3939
export("%>%")
40-
export(plot_ly)
4140
export(tidy)
4241
export(unnest_summarized_experiment)
4342
importFrom(S4Vectors,"metadata<-")
@@ -99,7 +98,6 @@ importFrom(pillar,get_extent)
9998
importFrom(pillar,style_subtle)
10099
importFrom(pillar,tbl_format_header)
101100
importFrom(pkgconfig,get_config)
102-
importFrom(plotly,plot_ly)
103101
importFrom(purrr,imap)
104102
importFrom(purrr,map)
105103
importFrom(purrr,map2)
@@ -142,6 +140,7 @@ importFrom(tidyselect,eval_select)
142140
importFrom(tidyselect,one_of)
143141
importFrom(ttservice,bind_cols)
144142
importFrom(ttservice,bind_rows)
143+
importFrom(ttservice,plot_ly)
145144
importFrom(utils,packageDescription)
146145
importFrom(utils,tail)
147146
importFrom(vctrs,new_data_frame)

R/plotly_methods.R

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
1-
#' @name plotly
2-
#' @rdname plotly
3-
#' @inherit plotly::plot_ly
1+
#' @name plot_ly
2+
#' @rdname plot_ly
3+
#' @inherit ttservice::plot_ly
44
#' @return `plotly`
55
#'
66
#' @examples
7-
#' data(pasilla)
8-
#' plot_ly(pasilla)
7+
#' data(se)
8+
#' se |>
9+
#' plot_ly(x = ~counts)
910
#'
10-
#' @importFrom plotly plot_ly
11-
#' @export
12-
plot_ly <- function(data=data.frame(), ..., type=NULL, name=NULL,
13-
color=NULL, colors=NULL, alpha=NULL,
14-
stroke=NULL, strokes=NULL, alpha_stroke=1,
15-
size=NULL, sizes=c(10, 100),
16-
span=NULL, spans=c(1, 20),
17-
symbol=NULL, symbols=NULL,
18-
linetype=NULL, linetypes=NULL,
19-
split=NULL, frame=NULL,
20-
width=NULL, height=NULL, source="A") {
21-
UseMethod("plot_ly")
22-
}
23-
24-
#' @rdname plotly
11+
#' @importFrom ttservice plot_ly
2512
#' @export
2613
plot_ly.tbl_df <- function(data=data.frame(), ..., type=NULL, name=NULL,
2714
color=NULL, colors=NULL, alpha=NULL,
@@ -32,10 +19,10 @@ plot_ly.tbl_df <- function(data=data.frame(), ..., type=NULL, name=NULL,
3219
linetype=NULL, linetypes=NULL,
3320
split=NULL, frame=NULL,
3421
width=NULL, height=NULL, source="A") {
35-
data %>%
22+
data |>
3623

3724
# This is a trick to not loop the call
38-
drop_class("tbl_df") %>%
25+
drop_class("tbl_df") |>
3926
plotly::plot_ly(...,
4027
type=type, name=name,
4128
color=color, colors=colors, alpha=alpha,
@@ -49,7 +36,17 @@ plot_ly.tbl_df <- function(data=data.frame(), ..., type=NULL, name=NULL,
4936
)
5037
}
5138

52-
#' @rdname plotly
39+
#' @name plot_ly
40+
#' @rdname plot_ly
41+
#' @inherit ttservice::plot_ly
42+
#' @return `plotly`
43+
#'
44+
#' @examples
45+
#' data(se)
46+
#' se |>
47+
#' plot_ly(x = ~counts)
48+
#'
49+
#' @importFrom ttservice plot_ly
5350
#' @export
5451
plot_ly.SummarizedExperiment <- function(data=data.frame(),
5552
..., type=NULL, name=NULL,
@@ -61,10 +58,10 @@ plot_ly.SummarizedExperiment <- function(data=data.frame(),
6158
linetype=NULL, linetypes=NULL,
6259
split=NULL, frame=NULL,
6360
width=NULL, height=NULL, source="A") {
64-
data %>%
61+
data |>
6562

6663
# This is a trick to not loop the call
67-
as_tibble() %>%
64+
as_tibble() |>
6865
plotly::plot_ly(...,
6966
type=type, name=name,
7067
color=color, colors=colors, alpha=alpha,

man/plotly.Rd renamed to man/plot_ly.Rd

Lines changed: 10 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)