Skip to content

Commit d4a43ac

Browse files
committed
improve docs
1 parent 835d1a6 commit d4a43ac

File tree

13 files changed

+78
-34
lines changed

13 files changed

+78
-34
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ Suggests:
7272
plotlyGeoAssets,
7373
forcats
7474
LazyData: true
75-
RoxygenNote: 6.0.1.9000
75+
RoxygenNote: 6.1.0
7676
Encoding: UTF-8
7777
Roxygen: list(markdown = TRUE)

R/style.R

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,30 @@
1313
#' @export
1414
#' @examples
1515
#'
16-
#' p <- qplot(data = mtcars, wt, mpg, geom = c("point", "smooth"))
17-
#' # keep the hover info for points, but remove it for the line/ribbon
16+
#' # style() is especially useful in conjunction with ggplotly()
17+
#' # It allows you to leverage the underlying plotly.js library to change
18+
#' # the return result of ggplotly()
19+
#' (p <- ggplotly(qplot(data = mtcars, wt, mpg, geom = c("point", "smooth"))))
20+
#'
21+
#' # removes hoverinfo for the line/ribbon traces (use `plotly_json()` to verify!)
1822
#' style(p, hoverinfo = "none", traces = c(2, 3))
1923
#'
24+
#' # another example with plot_ly() instead of ggplotly()
25+
#' marker <- list(
26+
#' color = "red",
27+
#' line = list(
28+
#' width = 20,
29+
#' color = "black"
30+
#' )
31+
#' )
32+
#' (p <- plot_ly(x = 1:10, y = 1:10, marker = marker))
33+
#'
34+
#' # note how the entire (marker) object is replaced if a list is provided
35+
#' style(p, marker = list(line = list(color = "blue")))
2036
#'
21-
#' # to turn the marker's red, without destroying the marker's other properties
37+
#' # similar to plotly.js, you can update a particular attribute like so
2238
#' # https://github.com/plotly/plotly.js/issues/1866#issuecomment-314115744
23-
#' style(p, marker.color = "red", traces = 1)
24-
#' style(p, marker.line.color = "red", traces = 1)
39+
#' style(p, marker.line.color = "blue")
2540
#'
2641
style <- function(p, ..., traces = NULL) {
2742
p <- plotly_build(p)

man/add_trace.Rd

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

man/api.Rd

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

man/highlight.Rd

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

man/orca.Rd

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

man/plot_dendro.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.

man/plot_ly.Rd

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

man/plotly-shiny.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.

man/plotly_IMAGE.Rd

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

0 commit comments

Comments
 (0)