Skip to content

Commit 042a6e2

Browse files
committed
document
1 parent 40a2b3e commit 042a6e2

File tree

5 files changed

+8
-30
lines changed

5 files changed

+8
-30
lines changed

R/add.R

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@ add_data <- function(p, data = NULL) {
2121

2222
#' Add trace(s) to a plotly visualization
2323
#'
24-
#' @param p a plotly or ggplot object.
25-
#' @param ... These arguments are documented in the references section below.
26-
#' Note that acceptable arguments depend on the trace type.
27-
#' @param color Either a variable name or a vector to use for color mapping.
28-
#' @param symbol Either a variable name or a (discrete) vector to use for symbol encoding.
29-
#' @param size A variable name or numeric vector to encode the size of markers.
30-
#' @param linetype Either a variable name or a (discrete) vector to use for linetype encoding.
31-
#' @param data A data frame to associate with this trace (optional). If not
32-
#' provided, arguments are evaluated using the data frame in \code{\link{plot_ly}()}.
24+
#' @inheritParams add_trace
3325
#' @param inherit inherit attributes from \code{\link{plot_ly}()}?
3426
#' @param z a numeric matrix
3527
#' @param x the x variable.

R/plotly.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#' \code{linetypes}. To avoid scaling, wrap with \code{\link{I}()}.
3030
#' @param linetypes A character vector of line types.
3131
#' Either valid \link{par} (lty) or plotly dash codes may be supplied.
32-
#' @param size A variable name or numeric vector to encode the size of markers.
32+
#' @param size A formula containing a name or expression yielding a numeric vector.
33+
#' Values are scaled according to the range specified in \code{sizes}.
3334
#' @param sizes A numeric vector of length 2 used to scale sizes to pixels.
3435
#' @param split A formula containing a name or expression. Similar to
3536
#' \code{\link{group_by}()}, but ensures at least one trace for each unique

R/plotly_build.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ plotly_build.plotly <- function(p) {
144144
# I don't think we ever want mesh3d's data attrs
145145
dataArrayAttrs <- if (identical(trace[["type"]], "mesh3d")) NULL else names(Attrs)[as.logical(isArray)]
146146
allAttrs <- c(
147-
dataArrayAttrs, special_attrs(trace), npscales(), ".plotlyGroupIndex",
147+
dataArrayAttrs, special_attrs(trace), npscales(),
148148
# for some reason, text isn't listed as a data array in some traces
149149
# I'm looking at you scattergeo...
150-
"text"
150+
".plotlyGroupIndex", "text"
151151
)
152152
tr <- trace[names(trace) %in% allAttrs]
153153
# TODO: does it make sense to "train" matrices/2D-tables (e.g. z)?
@@ -276,7 +276,7 @@ plotly_build.plotly <- function(p) {
276276
p$x$layout$showlegend <- FALSE
277277
} else {
278278
# shrink the colorbar
279-
idx <- which(vapply(p$x$data, function(x) inherits(x, "plotly_colorbar"), logical(1)))
279+
idx <- which(vapply(p$x$data, inherits, logical(1), "plotly_colorbar"))
280280
p$x$data[[idx]]$marker$colorbar <- modify_list(
281281
list(len = 1/2, lenmode = "fraction", y = 1, yanchor = "top"),
282282
p$x$data[[idx]]$marker$colorbar

man/add_trace.Rd

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

man/plot_ly.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)