multi_line: Multiple Dotted Lines

View source: R/dotted_line.R

multi_lineR Documentation

Multiple Dotted Lines

Description

Create multiple dotted lines in a plot_ly graph

Usage

multi_line(
  plot,
  df,
  x_col,
  yvec,
  textvec,
  .lineadjust = 0.5,
  .showarrow = T,
  .yshift = 5,
  .xshift = 2
)

Arguments

plot

Base-plotly chart

df

Base-dataframe

x_col

String name of x-axis column

yvec

Numeric vector of y-values at which to draw dotted lines

textvec

Character vector of labels for dotted lines; fed to glue function

.lineadjust

How much to adjust the length of the dotted line relative to the x-axis; default 0.5

.showarrow

Whether to show an arrow pointing to the dotted line or not; default T

.yshift

How much to adjust the y-axis position of the text label relative to the dotted line; default 5

.xshift

How much to adjust the x-axis position of the text label relative to the dotted line; default 2

Examples

{

quickplot <- plotly::plot_ly(mtcars,
x = ~ carb,
y = ~ disp,
type = "bar")

multi_line(quickplot, mtcars, "carb", c(200, 250), c("200 line", "250 line"))

}

dpowerstp/plotlywrappers documentation built on May 3, 2022, 10:29 p.m.