Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
william-hutchison committed Aug 8, 2023
1 parent 9163279 commit 6ec3157
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 82 deletions.
1 change: 0 additions & 1 deletion R/dplyr_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ distinct.SpatialExperiment <- function(.data, ..., .keep_all=FALSE) {
dplyr::distinct(..., .keep_all=.keep_all)
}


#' Subset rows using column values
#'
#'
Expand Down
7 changes: 2 additions & 5 deletions R/ggplot2_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,12 @@
#'
#' @export
#' @examples
#' \dontrun{
#' library(ggplot2)
#' `%>%` <- magrittr::`%>%`
#' example(read10xVisium)
#'
#' spe %>%
#` ggplot(aes(x = .cell, y = array_row)) +
#` geom_point()
#' }
#' ggplot(ggplot2::aes(x = .cell, y = array_row)) +
#' ggplot2::geom_point()
NULL

#' @export
Expand Down
13 changes: 12 additions & 1 deletion R/pillar_utilities.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
NBSP <- "\U00A0"

#' pillar format comment
#'
#' @keywords internal
#' @noRd
pillar___format_comment = function (x, width)
{
if (length(x) == 0L) {
Expand All @@ -8,14 +12,21 @@ pillar___format_comment = function (x, width)
map_chr(x, pillar___wrap, prefix = "# ", width = min(width, cli::console_width()))
}

#' pillar string wrap
#'
#' @importFrom fansi strwrap_ctl
#' @keywords internal
#' @noRd
pillar___strwrap2 = function (x, width, indent)
{
fansi::strwrap_ctl(x, width = max(width, 0), indent = indent,
exdent = indent + 2)
}


#' pillar wrap
#'
#' @keywords internal
#' @noRd
pillar___wrap = function (..., indent = 0, prefix = "", width)
{
x <- paste0(..., collapse = "")
Expand Down
43 changes: 7 additions & 36 deletions R/plotly_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,44 +95,15 @@
#'
#' @return A plotly
#' @export
#'
#' @examples
#' \dontrun{
#' # plot_ly() tries to create a sensible plot based on the information you
#' # give it. If you don't provide a trace type, plot_ly() will infer one.
#' plot_ly(economics, x=~pop)
#' plot_ly(economics, x=~date, y=~pop)
#' # plot_ly() doesn't require data frame(s), which allows one to take
#' # advantage of trace type(s) designed specifically for numeric matrices
#' plot_ly(z=~volcano)
#' plot_ly(z=~volcano, type="surface")
#'
#' # plotly has a functional interface: every plotly function takes a plotly
#' # object as it's first input argument and returns a modified plotly object
#' add_lines(plot_ly(economics, x=~date, y=~ unemploy / pop))
#'
#' # To make code more readable, plotly imports the pipe operator from magrittr
#' economics %>%
#' plot_ly(x=~date, y=~ unemploy / pop) %>%
#' add_lines()
#'
#' # Attributes defined via plot_ly() set 'global' attributes that
#' # are carried onto subsequent traces, but those may be over-written
#' plot_ly(economics, x=~date, color=I("black")) %>%
#' add_lines(y=~uempmed) %>%
#' add_lines(y=~psavert, color=I("red"))
#'
#' # Attributes are documented in the figure reference -> https://plot.ly/r/reference
#' # You might notice plot_ly() has named arguments that aren't in this figure
#' # reference. These arguments make it easier to map abstract data values to
#' # visual attributes.
#' p <- plot_ly(iris, x=~Sepal.Width, y=~Sepal.Length)
#' add_markers(p, color=~Petal.Length, size=~Petal.Length)
#' add_markers(p, color=~Species)
#' add_markers(p, color=~Species, colors="Set1")
#' add_markers(p, symbol=~Species)
#' add_paths(p, linetype=~Species)
#' }
#' `%>%` <- magrittr::`%>%`
#' example(read10xVisium)
#'
#' spe %>%
#' plot_ly(x=~array_col, y=~ array_row)
#'

plot_ly <- function(data=data.frame(), ..., type=NULL, name=NULL,
color=NULL, colors=NULL, alpha=NULL,
stroke=NULL, strokes=NULL, alpha_stroke=1,
Expand Down
2 changes: 2 additions & 0 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ get_special_datasets <- function(SpatialExperiment_object, n_dimensions_to_retur

mat
})
# Create list of special columns for SpatialExperiment

}

get_needed_columns <- function(.data) {
Expand Down
5 changes: 2 additions & 3 deletions man/ggplot2-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 5 additions & 36 deletions man/plot_ly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6ec3157

Please sign in to comment.